Skip to content

Instantly share code, notes, and snippets.

@epcim
Created August 24, 2021 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epcim/8e678d5b19719562735e923d7fe4c7d7 to your computer and use it in GitHub Desktop.
Save epcim/8e678d5b19719562735e923d7fe4c7d7 to your computer and use it in GitHub Desktop.
systemd.service and timer example
[Unit]
Description=KCD cron job
After=vpm.service
After=kubelet.service
[Service]
User=root
Type=oneshot
SyslogIdentifier=kcd
EnvironmentFile=-/etc/environment
EnvironmentFile=-/etc/default/kcd
ExecStartPre=-/bin/mkdir -p /var/lib/kcd
Restart=no
TimeoutStopSec=30
TimeoutStartSec=30
RemainAfterExit=no
TimeoutSec=120
#Not supported by our version
#ExecCondition=/opt/bin/kcd version
ExecStart=/opt/bin/kcd \
--verbose \
--config /etc/kcd.yaml \
cleanup
[Install]
WantedBy=multi-user.target
[Unit]
Description=Timer for KCD service
[Timer]
OnBootSec=30min
OnUnitActiveSec=1h
#OnCalendar=hourly
#Persistent=true
[Install]
WantedBy=timers.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment