Aim is to have program running inside screen restored on each machine reboot.
#! /bin/sh ### BEGIN INIT INFO # Provides: ctf # Required-Start: $local_fs $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Start warzone virtual # Description: start warzone virtual ### END INIT INFO NAME=ctf PIDFILE=/var/run/$NAME.pid case "$1" in start) logger poustim warzone rc skript start-stop-daemon --start -v -b --pidfile $PIDFILE -x /bin/su \ -m --chdir /home/ctf -- - ctf \ -c "/usr/bin/screen -L -dmS ctf -c /home/ctf/.screenrc-ctf" \ || return 2 ;; stop|restart|force-reload) # No-op ;; status) # No-op ;; *) echo "Usage: $NAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac
update-rc.d ctf defaults
update-rc.d ctf enable
autodetach on startup_message off screen -t ctf 0 sh -c 'cd /home/ctf; ./run2'