To make this answer a useful one, a minimal example for a daily automatic scheduled script at 01:30.
- Create two files, one service file and one timer file. Both names (.timer and .service) have to match. F.e.:
sudo vim /usr/lib/systemd/system/scheduledScript.service
sudo vim /usr/lib/systemd/system/scheduledScript.timer
(The folder /usr/lib/systemd/system/... is the default folder containing all .service files)
2.1 The File scheduledScript.service contains:
[Unit]
Description=Scheduled Script
[Service]
Type=simple
User=augusto
ExecStart=my_script.sh
2.2 The file scheduledScript.timer contains:
[Unit]
Description=Script Scheduling.
[Timer]
OnCalendar=*-*-* 01:30:00
[Install]
WantedBy=multi-user.target
And finally start the jobs:
sudo systemctl start scheduledScript.timer # to test
sudo systemctl enable scheduledScript.timer
Check if the job is successfully created:
sudo systemctl list-timers --all
and/or
sudo systemctl status scheduledScript.timer
journalctl -f -u scheduledScript.service
..that shows stuff like:
Trigger: Sun 2020-05-31 01:30:00 EDT; 10h left
source: https://unix.stackexchange.com/questions/261864/arch-linux-how-to-run-a-cron-job