Skip to content

Instantly share code, notes, and snippets.

@H0neyBadger
Last active January 20, 2018 15:36
Show Gist options
  • Save H0neyBadger/fc371492990af879c4c844fad3d4b6f0 to your computer and use it in GitHub Desktop.
Save H0neyBadger/fc371492990af879c4c844fad3d4b6f0 to your computer and use it in GitHub Desktop.
Systemd custom production target
# /etc/systemd/system/clear_custom.service
[Unit]
Description=Clear custom lock
After=custom.target
[Service]
Type=oneshot
ExecStart=/bin/rm /noprod
KillMode=process
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/custom.service
[Unit]
Description=Test service
[Service]
Type=oneshot
ExecStart=/usr/bin/touch /tmp/test
KillMode=process
[Install]
WantedBy=custom.target
# /etc/systemd/system/custom.target
[Unit]
Description=Custom target to manage user applications
Requires=multi-user.target
ConditionPathExists=!/noprod
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target
AllowIsolate=no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment