Yes this looks good to me.
- 0 Posts
- 3 Comments
You have two options that are most likely pre-installed: systemd-timer or cron
With systemd-timer you can run it as a user or as root. For your use case I would go with the user option for two reasons.
- The downloaded files will have the right permissions by default.
- Security. There is no reason why the service would need root access to your system.
For systemd-timer you need two files the .timer and the .system file.
your-timer.timer
[Unit] Description="Run your-service.service 5min after boot and every 24 hours relative to activation time" [Timer] OnBootSec=5min OnUnitActiveSec=24h Unit=your-service.service [Install] WantedBy=timers.targetyour-service.service
[Unit] Description=Download new podcasts [Service] Type=oneshot ExecStart=castget -cThese two files go into ~/.config/systemd/user/. Then run systemctl --user daemon-reload and systemctl --user enable your-timer.timer --now. If you want the service to also run if you are not logged in run sudo loginctl enable-linger youruser.
For cron it is less work. Just run cron -e and put your command in there preceded by the time it is supposed to run. The timeformat should be explained at the top of the file. I also don’t know if it will run if you are not logged in.


Also because I just remembered and it might be relevant to you. If you shut your system down and it is not running at 6am the cron job will not run that day. With systemd-timer it would check if it missed it’s run because the system was powered off and the run after boot the same day.