systemd timers instead of cron
For a job that runs once a night, a systemd timer is a service file plus a timer file. It is more typing than a crontab line, but you get logging and status for free.
The service
# /etc/systemd/system/cleanup.service
[Unit]
Description=Nightly cleanup
[Service]
Type=oneshot
ExecStart=/usr/local/bin/cleanup.sh
The timer
# /etc/systemd/system/cleanup.timer
[Unit]
Description=Run cleanup every night
[Timer]
OnCalendar=*-*-* 03:30:00
Persistent=true
RandomizedDelaySec=300
[Install]
WantedBy=timers.target
Enable it with systemctl enable --now cleanup.timer.
The two options worth knowing
Persistent=trueruns the job at the next boot if the machine was off at the scheduled time. Cron simply skips it.RandomizedDelaySecspreads start times, which is useful when many machines share the same schedule.
Looking at it
systemctl list-timers shows when each timer last ran and when it runs next. Output of the job goes to the journal: journalctl -u cleanup.service. To check a calendar expression before using it, run systemd-analyze calendar "*-*-* 03:30:00".