Screen or Daemontools

If you want to start some daemon in the background you can install daemontools and user supervise, but i like to use screen to start daemons in the background, so that i can easily see the output.

check screen if ! /usr/bin/screen -ls | awk '{print $1}' | grep ".${SCREEN_NAME}$" >/dev/null; then echo "starting $SCREEN_NAME" screen -S "${SCREEN_NAME}" -d -m "$COMMAND_SCRIPT" fi I use this snippet, to check of a screen with a given name exists and if not start it up, i run a script i call screen-ls.

4 minutes to read