Crontab stands for “cron table, ” because it uses the job scheduler cron to execute tasks, very popular on linux. Due to the review I have done, it is not possible to use this tool in PlcNext. I would like to verify this, and to know if there is any simulated tool that can be used to execute periodic tasks.
It should be possible to set up cron jobs using crontab. If that’s what you tried, can you give us more details of what didn’t work?
Thanks for the reply.
I was finally able to get it to work:
I used the following method:
For tasks that run once a day use the folder:
/etc/cron.daily
For tasks that run every hour use the folder:
/cron.hourly
To create the tasks:
1.- Create a file (script) without extension
sudo nano /etc/cron.daily/taskd
2.-Enter the instructions you want to be executed periodically, example
#!/bin/bash
this is a cron test
echo “this cron job will run every day”
3.-Add the permissions:
chod +x taskh
4.- Validate the files that will be executed:
run-parts --test /etc/cron.daily > /etc/cron.daily/taskh
--test print the names of the scripts which would be run, but don’t actually run them.
5.- Test
run-parts /etc/cron.daily > this cron job will run every hour
Additionally,
Validate that the cron service is active:
sudo /etc/init.d/crond status
Validate when the tasks created in /etc/cron.daily, /cron.hourly should be executed
cat /etc/crontab
# m h dom mon dow user command 1 * * * * root cd / && run-parts /etc/cron.hourly # 30 7 * * * root cd / && run-parts /etc/cron.daily # 42 7 * * 7 root cd / && run-parts /etc/cron.weekly # 55 7 1 * * root cd / && run-parts /etc/cron.monthly