Skip to content

Instantly share code, notes, and snippets.

@roblayton
Last active September 10, 2022 13:13
Show Gist options
  • Save roblayton/280cbbf6e9ece86195a2 to your computer and use it in GitHub Desktop.
Save roblayton/280cbbf6e9ece86195a2 to your computer and use it in GitHub Desktop.
An example hello world service for Systemd
[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