add -fPIC option to the C compiler, required in f31
[vsys.git] / vsys-initscript
index 5ade750..cfeba9a 100755 (executable)
@@ -1,16 +1,56 @@
 #!/bin/bash
+#
+# chkconfig: 345 84 02
+# description: Vsys file descriptor abritrator startup.
+#
+# Sapan Bhatia <sapanb@cs.princeton.edu>
+#
+# $Id$
+# $HeadURL$
+#
+name="vsys"
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+if [ -f /etc/sysconfig/$name ]; then
+    . /etc/sysconfig/$name
+fi
+
+backend=${BACKEND-/vsys}
+
+conf=${CONF-/etc/$name.conf}
+pidfile=${PIDFILE-/var/run/$name.pid}
+lockfile=${LOCKFILE-/var/lock/subsys/$name}
+RETVAL=0
+
+vsys=${VSYS- "/usr/bin/vsys -failsafe -backend $backend -conffile $conf -daemon"}
 
 case "$1" in
-    start|restart|reload|update)
-       ;;
-    stop|status)
-       exit 0
-       ;;
+    start)
+        echo -n "Starting $name:"
+        if [ ! -d $backend ]; then mkdir $backend; fi
+        daemon --check=vsys $vsys 
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && touch ${lockfile}
+        ;;
+    stop)
+        echo -n "Stopping $name:"
+        killproc $name
+        #killproc $name - Why were there 2 instances of this? :-|
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}
+        ;;
+    restart)
+        $0 stop
+        $0 start
+        RETVAL=$?
+        ;;
     *)
-       echo $"Usage: $0 {start|stop|restart|status}"
-       exit 1
-       ;;
+        echo $"Usage: $0 {start|stop|restart}"
+        exit 1
+        ;;
 esac
 
-# Source function library.
-. /etc/rc.d/init.d/functions