Manage Cron Jobs (tasks)¶
Helpful feature for making crons
We recommend using crontab.guru editor for cron schedule expressions, if you know what you do.
Adding cron task¶
You need to select the required project and log in to the Server panel manager in order to add or remove a scheduled job. Further you have to open tab "Scheduler" on your server settings page, insert a cron description in the Description field and its command in the Command field, and select the required frequency from the suggested options or specify another frequency in the Frequency field directly. When all the parameters are set up, click Add new scheduled job — done , the cron job is added to the server configuration.
Recommended way of cron recording
We recommend using a secure and correct way to add a cron task:
php /srv/projects/example.com/public_html/admin_or_crontask.php --dispatch=some.dispatch_name --cron_password=s0m3S3cur3P4ssw0rd
curl "hXXp://example.com/admin_or_crontask.php?dispatch=some.dispatch_name&cron_password=s0m3S3cur3P4ssw0rd"
Extended settings for the CRON job¶
Enable log file with task output¶
You are able to store the history of your STDOUT and STDERR logs on your server, and even send them by email.
If you are not using Scalesta mail service, you are only able to store logs on your server. To do that, select Save logs output in fields Log file with task output
for STDOUT logs and Log file with task error
for STDERR logs.
If you are using Scalesta mail service, you can also select options for sending logs by mail. Choose Send logs, save output if you need storing logs on server and sending by mail, or Send logs, suppress logs output if you don't want to store logs on server. After this, edit your email above the list of cron task on the Server settings page, then save it, and your logs will be sent to your mail.
Timeout of the task¶
This option sets
- Timeout for the task parameter can limitate task execution time
- Default: not limited, maximum: 300 sec
- Count of retries in case of timeout available if Timeout for the task is set
- Default: 0, maximum: 3
- Count of retries in case of error
- Default: 0, maximum: 3
Active Cron Jobs (tasks) management¶
Every added cron task appears in the Scheduled Jobs list where you can see the Command, Frequency of the cron task. You can also edit or remove a cron task if it is no longer required by clicking Edit or Remove accordingly in Actions menu. Here you can also run cron job manually or check it's result.
Manually running Cron Jobs¶
You are able to run your cron tasks manually. Open the task actions and click "Run cron job manually" button. Check if you need to see error output and confirm the action.
After running start, you will be redirected to the result logs page, where you can see all previous manual running results. You can open this page from cron tasks list page by clicking the "Show running results" as well.
Be careful, this page only shows results of manually running tasks.
If your task is finished successfully, you will see it in the list with green header. If task is failed, you will see it with red header.
You can open task to check full output and errors.
Temporary disabling Cron Jobs¶
You are able to temporary disable your cron tasks. Open the task actions and click "disable" button.
Then, confirm disabling.
After disabling, your cron job will be marked in list by additional "Pause" icon and gray color.
When you need to enable your cron job, click the "Enable" button and confirm this action.
Need assistance?
If you have a problem, need assistance with tweaks or a free consultation, if you just want to discuss your project with experts and estimate the outcome, if you're looking for a solution that reinforces your online business, we will help. Let us know through Scalesta account.