#!/bin/bash # # # ### BEGIN INIT INFO # Provides: # Required-Start: 1,2,5 # Required-Stop: # Default-Start: 1,2,5 # Default-Stop: # Description: # Short-Description ### END INIT INFO case "\$1" in start) start-stop-daemon --start --exec /home/david/myserverd ;; stop) start-stop-daemon --stop --exec /home/david/myserverd ;; reload|restart) start-stop-daemon --stop --exec /home/david/myserverd start-stop-daemon --start --exec /home/david/myserverd ;; esac
Install with
# update-rc.d myserver001.sh defaults # update-rc.d myserver001.sh enableOutput:
# journalctl | grep "Hallo Welt" # root@work:/home/david/bash-2023-11-05# journalctl | grep "Hallo Welt" # Nov 05 19:03:55 work myserver001.sh[16670]: Hallo Welt # Nov 05 19:04:18 work myserver001.sh[16696]: Hallo Welt # Nov 05 19:06:07 work myserver001.sh[16760]: Hallo Welt # Nov 05 19:08:37 work myserver001.sh[16899]: Hallo Welt