If I understand you right, you mean with...
How to run a 'cron' job
...scheduled events on arch Linux. That's pretty simple using
systemd/Timers as a cron replacement.
Although cron is arguably the most well-known job scheduler, systemd timers can be an alternative.
Benefits
The main benefits of using timers come from each job having its own systemd service. Some of these benefits are:
- Jobs can be easily started independently of their timers. This
simplifies debugging.
- Each job can be configured to run in a specific environment (see
systemd.exec(5)).
- Jobs can be attached to cgroups.
- Jobs can be set up to depend on other systemd units.
- Jobs are logged in the systemd journal for easy debugging.
...as mentioned here
If you have to use cron it is still possible and described here.
To make this answer a useful one, a minimal example for a daily automatic scheduled reboot at 01:30.
1.
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/scheduledReboot.service
sudo vim /usr/lib/systemd/system/scheduledReboot.timer
(The folder /usr/lib/systemd/system/... is the default folder containing all .service files just fyi)
2.1
The File scheduledReboot.service contains:
[Unit]
Description=Scheduled Reboot
[Service]
Type=simple
ExecStart=/usr/bin/systemctl --force reboot
2.2
The file scheduledReboot.timer contains:
[Unit]
Description=Reboot Scheduling.
[Timer]
OnCalendar=*-*-* 01:30:00
[Install]
WantedBy=multi-user.target
- And finally start the jobs:
sudo systemctl start scheduledReboot.timer
sudo systemctl enable scheduledReboot.timer
- Check if the job is successfully created:
sudo systemctl list-timers --all
and/or
sudo systemctl status scheduledReboot.timer
..that shows stuff like:
Trigger: Sun 2020-05-31 01:30:00 EDT; 10h left
I personally really like the systemd / .service approach since I use all my system jobs with systemctl like automatic mounting my nfs drives and so on and it works really well and efficient.
crond
, percrontab(5)
.cron
?)/srv/shiny-system/cron/CPU.R
exists and have execute permissions ? Also as which user (root or non-root) are you trying to run this crom job ?