I've searched through some answers but nothing seems to clarify my confusion.
I have a cron job I want to run every 5 minutes:
*/5 * * * * cd /mnt/internal-storage/coindata && shell/command coins update
Do I place this in the /etc/cron.daily folder or create a /etc/cron.minutely?
Also what kind of file I create inside this folder?
Best Answer
The best solution for this is likely to add a line to your crontab. Accessing the crontab file may differ between implementations of cron, so I've provided commands for the two cron implementations in the official Arch repos. If you want a solution that does not require a specific cron implementation, I've written another answer that uses systemd/Timers instead.
crontab -e
or variants of it use the EDITOR environment variable (defaults to vi). If you wish to use a different editor, export it to the EDITOR variable like so:where vim is replaced with the editor of your choice.
Editing crontab with cronie:
Editing crontab with fcron:
Add your cron command to the file and save it:
The format for lines in this file is
If cron is not running, start its daemon.
For cronie:
systemctl start cronie.service
For fcron:
systemctl start fcron.service
If you want the commands in the crontab to continue to run after rebooting, make sure that the cron daemon is enabled:
systemctl enable cronie.service
orsystemctl enable fcron.service