This is an old revision of the document!
Service Builder
Here are my shell script services that I use on most servers. These predate systemd by a few years, hence not being systemd units. These all use cronjobs to keep them running similar to:
* * * * /usr/bin/flock –nonblock /tmp/apache-restart.lock /bin/bash /usr/local/bin/apache-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/mariadb-restart.lock /bin/bash /usr/local/bin/mariadb-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/fail2ban-restart.lock /bin/bash /usr/local/bin/fail2ban-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/qemuagent-restart.lock /bin/bash /usr/local/bin/qemuagent-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/amavis-restart.lock /bin/bash /usr/local/bin/amavis-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/clamav-restart.lock /bin/bash /usr/local/bin/clamav-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/dovecot-restart.lock /bin/bash /usr/local/bin/dovecot-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/postfix-restart.lock /bin/bash /usr/local/bin/postfix-restart.sh > /dev/null 2>&1
* * * * /usr/bin/flock –nonblock /tmp/spamass-restart.lock /bin/bash /usr/local/bin/spamass-restart.sh > /dev/null 2>&1
0 4 * * * /usr/bin/flock –nonblock /tmp/mariadb-dump.lock /bin/bash /usr/local/bin/mariadb-dump.sh > /dev/null 2>&1