diff --git a/nmb.init b/nmb.init index 86c218e..08e34cc 100644 --- a/nmb.init +++ b/nmb.init @@ -14,7 +14,7 @@ if [ -f /etc/init.d/functions ] ; then elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else - exit 0 + exit 1 fi # Avoid using root's TMPDIR @@ -28,10 +28,10 @@ if [ -f /etc/sysconfig/samba ]; then fi # Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 +[ ${NETWORKING} = "no" ] && exit 1 # Check that smb.conf exists. -[ -f /etc/samba/smb.conf ] || exit 0 +[ -f /etc/samba/smb.conf ] || exit 6 RETVAL=0 @@ -72,9 +72,7 @@ reload() { rhstatus() { status nmbd - if [ $? -ne 0 ] ; then - return 1 - fi + return $? } @@ -85,7 +83,7 @@ if [ "$1" = status ]; then fi # Check that we can write to it... so non-root users stop here -[ -w /etc/samba/smb.conf ] || exit 0 +[ -w /etc/samba/smb.conf ] || exit 4 @@ -110,7 +108,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" - exit 1 + exit 2 esac exit $? diff --git a/smb.init b/smb.init index a8671aa..fbb6152 100644 --- a/smb.init +++ b/smb.init @@ -14,7 +14,7 @@ if [ -f /etc/init.d/functions ] ; then elif [ -f /etc/rc.d/init.d/functions ] ; then . /etc/rc.d/init.d/functions else - exit 0 + exit 1 fi # Avoid using root's TMPDIR @@ -28,10 +28,10 @@ if [ -f /etc/sysconfig/samba ]; then fi # Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 +[ ${NETWORKING} = "no" ] && exit 1 # Check that smb.conf exists. -[ -f /etc/samba/smb.conf ] || exit 0 +[ -f /etc/samba/smb.conf ] || exit 6 RETVAL=0 @@ -72,9 +72,7 @@ reload() { rhstatus() { status smbd - if [ $? -ne 0 ] ; then - return 1 - fi + return $? } @@ -85,7 +83,7 @@ if [ "$1" = status ]; then fi # Check that we can write to it... so non-root users stop here -[ -w /etc/samba/smb.conf ] || exit 0 +[ -w /etc/samba/smb.conf ] || exit 4 @@ -110,7 +108,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" - exit 1 + exit 2 esac exit $? diff --git a/winbind.init b/winbind.init index 8251f9a..88ce028 100644 --- a/winbind.init +++ b/winbind.init @@ -17,10 +17,10 @@ unset TMPDIR . /etc/sysconfig/network # Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 +[ ${NETWORKING} = "no" ] && exit 1 # Check that smb.conf exists. -[ -f /etc/samba/smb.conf ] || exit 0 +[ -f /etc/samba/smb.conf ] || exit 6 [ -f /etc/sysconfig/samba ] && . /etc/sysconfig/samba @@ -63,8 +63,18 @@ reload() { rhstatus() { status winbindd + return $? } +# Allow status as non-root. +if [ "$1" = status ]; then + rhstatus + exit $? +fi + +# Check that we can write to it... so non-root users stop here +[ -w /etc/samba/smb.conf ] || exit 4 + case "$1" in start) start @@ -86,7 +96,7 @@ case "$1" in ;; *) echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}" - exit 1 + exit 2 esac exit $?