sblim-sfcb/sblim-sfcb-1.3.7-initscript.patch
2010-04-22 12:04:57 +00:00

90 lines
1.9 KiB
Diff

diff -up sblim-sfcb-1.3.7/sfcb.init-redhat.in.orig sblim-sfcb-1.3.7/sfcb.init-redhat.in
--- sblim-sfcb-1.3.7/sfcb.init-redhat.in.orig 2010-04-20 16:02:21.000000000 +0200
+++ sblim-sfcb-1.3.7/sfcb.init-redhat.in 2010-04-22 13:32:36.588476172 +0200
@@ -13,6 +13,9 @@
# Source function library.
. /etc/init.d/functions
+SFCB_BIN=@sbindir@/sfcbd
+LOCKFILE=/var/lock/subsys/sblim-sfcb
+
echo $PATH | grep -q @sbindir@ ||PATH=@sbindir@:$PATH
if [ -z "$LD_LIBRARY_PATH" ] || echo $LD_LIBRARY_PATH | grep -qv @libdir@
@@ -22,17 +25,25 @@ then
fi
start() {
+ if [[ $EUID -ne 0 ]]; then
+ echo "sfcb executed under nonprivileged user"
+ exit 4
+ fi
echo -n "Starting sfcb: "
- daemon @sbindir@/sfcbd -d &&
- touch /var/lock/subsys/sfcb &&
+ daemon $SFCB_BIN -d &&
+ touch $LOCKFILE &&
return 0 ||
return 1
}
stop() {
+ if [[ $EUID -ne 0 ]]; then
+ echo "sfcb executed under nonprivileged user"
+ exit 4
+ fi
echo -n "Shutting down sfcb: "
killproc sfcbd &&
- rm -f /var/lock/subsys/sfcb &&
+ rm -f $LOCKFILE &&
return 0 || return 1
}
@@ -50,9 +61,30 @@ case "$1" in
stop
;;
status)
- status sfcbd
+ pid=`pidofproc $SFCB_BIN`
+ RETVAL=$?
+ if [ "$RETVAL" -eq 0 ]; then
+ echo -n $"sfcb ($pid) is running"
+ exit 0
+ else
+ if [ -e /var/run/tog-pegasus.pid ]; then
+ echo $"sfcb is not running, but pid file exists"
+ exit 1
+ elif [ -e $LOCKFILE ]; then
+ echo $"sfcb is not running, but lock file exists"
+ exit 2
+ else
+ echo $"sfcb is not running"
+ exit 3
+ fi
+ fi
+ echo
;;
restart)
+ if [[ $EUID -ne 0 ]]; then
+ echo "sfcb executed under nonprivileged user"
+ exit 4
+ fi
stop
start
;;
@@ -60,11 +92,12 @@ case "$1" in
reload
;;
condrestart)
- [ -f /var/lock/subsys/sfcb ] && restart || :
+ [ -f $LOCKFILE ] && restart || :
;;
*)
echo "Usage: sfcb {start|stop|status|reload|restart|condrestart}"
- exit 1
+ [ "$1" = "usage" ] && exit 0
+ exit 2
;;
esac
exit $?