forked from pool/ocfs2-tools
92 lines
2.1 KiB
Diff
92 lines
2.1 KiB
Diff
--- ocfs2-tools/ocfs2_controld/main.c
|
|
+++ ocfs2-tools/ocfs2_controld/main.c
|
|
@@ -1027,6 +1027,7 @@
|
|
|
|
static void daemonize(void)
|
|
{
|
|
+ int fd;
|
|
pid_t pid = fork();
|
|
if (pid < 0) {
|
|
perror("main: cannot fork");
|
|
@@ -1040,6 +1041,18 @@
|
|
close(0);
|
|
close(1);
|
|
close(2);
|
|
+ fd = open("/dev/null", O_RDWR);
|
|
+ if (fd >= 0) {
|
|
+ /* dup2 to 0 / 1 / 2 (stdin / stdout / stderr) */
|
|
+ dup2(fd, STDIN_FILENO); /* 0 */
|
|
+ dup2(fd, STDOUT_FILENO); /* 1 */
|
|
+ dup2(fd, STDERR_FILENO); /* 2 */
|
|
+
|
|
+ /* Should be 0, but just in case it isn't... */
|
|
+ if (fd > 2) {
|
|
+ close(fd);
|
|
+ }
|
|
+ }
|
|
openlog("ocfs2_controld", LOG_PID, LOG_DAEMON);
|
|
|
|
lockfile();
|
|
--- ocfs2-tools/vendor/common/o2cb.init.sh
|
|
+++ ocfs2-tools/vendor/common/o2cb.init.sh
|
|
@@ -8,7 +8,8 @@
|
|
# Provides: o2cb
|
|
# Required-Start: $network
|
|
# Should-Start:
|
|
-# Required-Stop:
|
|
+# Should-Stop:
|
|
+# Required-Stop: $null
|
|
# Default-Start: 2 3 5
|
|
# Default-Stop:
|
|
# Short-Description: Load O2CB cluster services at system boot.
|
|
@@ -653,7 +654,7 @@
|
|
|
|
status_daemon()
|
|
{
|
|
- DAEMON="/sbin/ocfs2_controld.${O2CB_STACK}"
|
|
+ DAEMON="/usr/sbin/ocfs2_controld.${O2CB_STACK}"
|
|
echo -n "Checking for control daemon: "
|
|
if [ -n "$(pidofproc "$DAEMON")" ]
|
|
then
|
|
@@ -667,7 +668,7 @@
|
|
|
|
bringup_daemon()
|
|
{
|
|
- DAEMON="/sbin/ocfs2_controld.${O2CB_STACK}"
|
|
+ DAEMON="/usr/sbin/ocfs2_controld.${O2CB_STACK}"
|
|
echo -n "Starting $(basename "$DAEMON"): "
|
|
start_daemon "$DAEMON"
|
|
[ $? != 0 ] && return 1
|
|
@@ -682,6 +683,7 @@
|
|
fi
|
|
sleep 1
|
|
done
|
|
+ sleep 2
|
|
|
|
return 0
|
|
}
|
|
@@ -689,7 +691,7 @@
|
|
kill_daemon()
|
|
{
|
|
SIGNAL="$1"
|
|
- DAEMON="/sbin/ocfs2_controld.${O2CB_STACK}"
|
|
+ DAEMON="/usr/sbin/ocfs2_controld.${O2CB_STACK}"
|
|
|
|
status_daemon >/dev/null 2>&1 || return 2
|
|
|
|
--- ocfs2-tools/vendor/common/ocfs2.init
|
|
+++ ocfs2-tools/vendor/common/ocfs2.init
|
|
@@ -8,9 +8,9 @@
|
|
### BEGIN INIT INFO
|
|
# Provides: ocfs2
|
|
# Required-Start: $network o2cb
|
|
-# Required-Stop:
|
|
-# X-UnitedLinux-Should-Start:
|
|
-# X-UnitedLinux-Should-Stop:
|
|
+# Required-Stop: $null
|
|
+# Should-Start:
|
|
+# Should-Stop:
|
|
# Default-Start: 2 3 5
|
|
# Default-Stop:
|
|
# Short-Description: Mount OCFS2 volumes at boot.
|