Skip to content

Instantly share code, notes, and snippets.

@adamsdesk
Last active February 1, 2016 15:47
Show Gist options
  • Save adamsdesk/55142219a706a32afda7 to your computer and use it in GitHub Desktop.
Save adamsdesk/55142219a706a32afda7 to your computer and use it in GitHub Desktop.
Urban Terror Systemd service unit file. Used to run Urban Terror server as a daemon. Sends a notification on failure to a desired email address.
[Unit]
Description=status email for %i to notify
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/systemd-email notify@example.com %i
User=root
Group=systemd-journal
#!/bin/bash
/usr/bin/mail -s "[$HOSTNAME] $2 Failed" $1 <<EOF
$(systemctl status --full "$2")
EOF
[Unit]
Description=Urban Terror Server
Before=shutdown.target reboot.target halt.target
After=network.target
OnFailure=status-email-send@%n.service
[Service]
ExecStart=/usr/bin/screen -m -d -S UrT-Server /home/urt/UrbanTerror42/Quake3-UrT-Ded.x86_64 +set fs_game q3ut4 +set dedicated 2 +set net_port 27960 +set com_hunkmegs 128 +exec server.cfg
ExecStop=/usr/bin/screen -S UrT-Server -X quit
ExecReload=/usr/bin/screen -S UrT-Server -X quit && /usr/bin/screen -m -d -S UrT-Server /home/urt/UrbanTerror42/Quake3-UrT-Ded.x86_64 +set fs_game q3ut4 +set dedicated 2 +set net_port 27960 +set com_hunkmegs 128 +exec server.cfg
KillMode=none
Restart=on-failure
Environment=SYSTEMD_LOG_LEVEL=debug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment