Last active
September 10, 2022 13:13
-
-
Save roblayton/280cbbf6e9ece86195a2 to your computer and use it in GitHub Desktop.
An example hello world service for Systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description="Hello Service 01" | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
TimeoutStartSec=0 | |
ExecStartPre=-/usr/bin/docker kill busybox1 | |
ExecStartPre=-/usr/bin/docker rm busybox1 | |
ExecStartPre=-/usr/bin/docker pull busybox | |
ExecStart=/usr/bin/docker run --name busybox1 busybox /bin/sh -c "while true; do echo Hello World 1; sleep 1; done" | |
ExecStartPost=/usr/bin/etcdctl set /domains/hello-01/%H:%i running | |
ExecStop=/usr/bin/docker stop busybox1 | |
ExecStopPost=/usr/bin/etcdctl rm /domains/hello-01/%H:%i | |
[X-Fleet] | |
Conflicts=hello*.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment