Skip to content

Instantly share code, notes, and snippets.

@h0rn3t
Forked from circa10a/test.service
Created December 23, 2020 12:19
Show Gist options
  • Save h0rn3t/fd42a5521b59a3960e147d8a05f12ca4 to your computer and use it in GitHub Desktop.
Save h0rn3t/fd42a5521b59a3960e147d8a05f12ca4 to your computer and use it in GitHub Desktop.
A Simple Systemd Service
#/etc/systemd/system/test.service
[Unit]
Description=Test Systemd Service
[Service]
ExecStartPre=/usr/bin/echo -e "\033[0;33m Pre start \033[0m"
ExecStart=/usr/bin/sleep 10
ExecStartPost=/usr/bin/echo -e "\033[0;33m Post start \033[0m"
ExecStop=/usr/bin/pkill -f sleep
ExecStopPost=/usr/bin/echo -e "\033[0;33m Post stop \033[0m"
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment