Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[Unit]
Description=Good morning lazybones!

[Service]
Type=oneshotsimple
ExecStart=/bin/echo "Dear lazybones!, it's a new morning. Love from your system @$(date)" > /var/www/good-morning
Restart=on-failure
RestartSec=30s


Info

The Restart=on-failure and RestartSec=30s aren't really needed here but are handy if we might reasonably expect our ExecStart process to fail (e.g. unclean exit code) and we wanted it to keep trying until it succeeded.

We can this by reloading units in systemd and running our service (can then check that the file was generated):

...