# Source function library.
. /etc/rc.d/init.d/functions
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_no "${NETWORKING}"; then
+ msg_Network_Down Vtund
+ exit 1
+fi
+
# See how we were called.
case "$1" in
start)
- show Starting vtund
- daemon /usr/sbin/vtund -s
- touch /var/lock/subsys/vtund
+ # Check if the service is already running?
+ if [ ! -f /var/lock/subsys/vtund ]; then
+ msg_starting Vtund
+ daemon vtund -s
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/vtund
+ else
+ msg_Already_Running Vtund
+ exit 1
+ fi
+
;;
stop)
- show Stopping vtund
- killproc vtund
- rm -f /var/lock/subsys/vtund
+ # Stop daemons.
+ if [ -f /var/lock/subsys/vtund ]; then
+ msg_stopping Vtund
+ killproc vtund
+ rm -f /var/lock/subsys/vtund >/dev/null 2>&1
+ else
+ msg_Not_Running Vtund
+ exit 1
+ fi
;;
restart)
$0 stop
;;
status)
status vtund
+ exit $?
;;
*)
- echo "Usage: vtund {start|stop|restart|status}"
+ msg_Usage "$0 {start|stop|restart|status}"
exit 1
esac
-exit 0
+exit $RETVAL