...
Code Block |
---|
[Unit]
Description=Good morning lazybones!
[Service]
Type=oneshot
ExecStart=/bin/echo "Dear lazybones!, it's a new morning. Love from your system @$(date)" > /var/www/good-morning |
...
The Persistent option enables the service to trigger if it didn't when it should have previously (e.g because the computer/server was down / off / thrown out the window etc.).
Let's now reload systemd, enable, and enable start the timer:
Code Block | ||
---|---|---|
| ||
sudo systemctl daemon-reload
sudo systemctl enable good-morning.timer
sudo systemctl start good-morning.timer |
That's it. You should now get a nice (rude?) text file created in /var/www every morning at 6.30am.
...