kb:daemonize_screen
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | kb:daemonize_screen [2012/09/14 22:38] (current) – created ruza | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Daemonize program into screen ====== | ||
+ | |||
+ | Aim is to have program running inside screen restored on each machine reboot. | ||
+ | |||
+ | <file bash / | ||
+ | #! /bin/sh | ||
+ | ### BEGIN INIT INFO | ||
+ | # Provides: | ||
+ | # Required-Start: | ||
+ | # Required-Stop: | ||
+ | # Default-Start: | ||
+ | # Default-Stop: | ||
+ | # Short-Description: | ||
+ | # Description: | ||
+ | ### END INIT INFO | ||
+ | |||
+ | NAME=ctf | ||
+ | PIDFILE=/ | ||
+ | |||
+ | case " | ||
+ | start) | ||
+ | logger poustim warzone rc skript | ||
+ | start-stop-daemon --start -v -b --pidfile $PIDFILE -x /bin/su \ | ||
+ | -m --chdir /home/ctf -- - ctf \ | ||
+ | -c "/ | ||
+ | || return 2 | ||
+ | |||
+ | ;; | ||
+ | stop|restart|force-reload) | ||
+ | # No-op | ||
+ | ;; | ||
+ | status) | ||
+ | # No-op | ||
+ | ;; | ||
+ | *) | ||
+ | echo " | ||
+ | exit 3 | ||
+ | ;; | ||
+ | esac | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | update-rc.d ctf defaults | ||
+ | update-rc.d ctf enable | ||
+ | </ | ||
+ | |||
+ | <file bash / | ||
+ | autodetach on | ||
+ | startup_message off | ||
+ | |||
+ | screen -t ctf 0 sh -c 'cd /home/ctf; ./ | ||
+ | </ | ||
+ | |||
kb/daemonize_screen.txt · Last modified: 2012/09/14 22:38 by ruza