#!/bin/sh # ### BEGIN INIT INFO # Provides: anyterm # Required-Start: $syslog $local_fs $remote_fs # Required-Stop: $syslog $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts/stops anyterm # Description: starts and stops Anyterm, # ### END INIT INFO PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin DAEMON=/usr/bin/anytermd PORT=7676 PIDFILE=/var/run/anytermd.pid NAME=anyterm DESC="web based terminal anyterm" if [ $(id -u) != 0 ]; then echo "You should run this program as root" exit 1 fi [ -x "$DAEMON" ] || exit 0 #[ -f "/etc/default/anyterm" ] && . /etc/default/anyterm . /lib/lsb/init-functions case "$1" in start) log_begin_msg "Starting $DESC:" "$NAME" if [ -f $PIDFILE ]; then log_action_cont_msg " already running" log_end_msg 1 else #start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --user root -c /bin/login >/dev/null $DAEMON -p $PORT --local-only --user root -c /bin/login log_end_msg $? fi ;; stop) log_begin_msg "Stopping $DESC:" "$NAME" start-stop-daemon --stop --pidfile $PIDFILE rm -f $PIDFILE log_end_msg $? ;; status) status_of_proc -p $PIDFILE $DAEMON anytermd && exit 0 || exit $2 ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac