Lidong,
first part is good catch for distros without /etc/init.d/functions. I
believe better solution is to change rtrn in status function to
something different (like res, ...) so it will not collide with global rtrn.
Lock directory creation seems for me like a HUGE hack. This should be
really created by package with correct selinux context, ... Do you have
any specific use case for creating lock dir in init script?
Regards,
Honza
> When corosync is started by systemd, it would be considered
as failed because it returns a non-zero value, even though it
starts sucessfully.
Also creating the lock directory before creating the lock file.
Signed-off-by: Lidong Zhong <lzhong@xxxxxxxx>
Signed-off-by: Xia Li <xli@xxxxxxxx>
---
init/corosync.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/init/corosync.in b/init/corosync.in
index 4bc6041..5ded5fc 100755
--- a/init/corosync.in
+++ b/init/corosync.in
@@ -29,6 +29,7 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin:@SBINDIR@"
success()
{
echo -ne "[ OK ]\r"
+ rtrn=0
}
failure()
@@ -53,12 +54,14 @@ if [ -d @SYSCONFDIR@/sysconfig ]; then
[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
[ -f @SYSCONFDIR@/sysconfig/$prog ] && . @SYSCONFDIR@/sysconfig/$prog
[ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/subsys/$prog"
+ mkdir -p @LOCALSTATEDIR@/lock/subsys
fi
# deb based distros
if [ -d @SYSCONFDIR@/default ]; then
[ -f @SYSCONFDIR@/default/$prog ] && . @SYSCONFDIR@/default/$prog
[ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
+ mkdir -p @LOCALSTATEDIR@/lock
fi
# The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss