Mar 15, 2022
A cron job is a task that a server will run. In most cases, it is a script to be run at a designated time. These scripts can be run from as little as every minute per day (1,440 minutes in a day, therefore, it would run 1,440 times per day) or you can run a cron job once per day, once per week, or even once per year.
After clicking into your server, on the navigation menu, choose Cron Job. Set your cron job task. Then click Create Cronjob.
/bin/bashwhich is where it will be called from when running a cron job.
Command is where you will add the command you want to run including the script of what you want to run. For example, if you want to create a new log file everyday with some type of information, you would add a script like this:
bash * * * * * /runcloud/user/rc-user/myapp/public/scripts/random.php
wget -q -O /dev/null https://blog.runcloud.io/wp-cron.php
This is a script that tells the computer, "run the random.php file every minute". Since RunCloud does not require you to enter this into the Terminal, you can use the RunCloud dashboard to do the job for you.
Predefined Settings is where you would designate how often the script should run. While running it every minute is fine, it really depends on what the script is actually doing. If you are only running a few lines of code every minute, than it is no big deal. However, if you have hundreds to thousands of lines of code running automatically every minute, this may put some demand on your server.