Crontab, short for “cron table,” is a Linux program for maintaining and scheduling cron jobs. Common tasks you might automate include:
- System backups
- SSL certificate renewal
- Malware and file integrity scans
When only using the terminal, novice programmers may find themselves researching cron job syntax for their preferred schedule since “* * * * *” doesn’t include any contextual clues.
Control Web Panel fixes this problem. Instead of you having to figure out how each digit affects the date and time of execution, the CWP cron job manager uses labeled drop-down menus with basic options in a human-readable format. If you need something to run daily you’ll select “Once a day” instead of having to type “0 0 * * *.”
- Manage Cron Jobs in Control Web Panel as Root
- Verify Cron Jobs
Manage Cron Jobs in Control Web Panel as Root
CWP administrators can manage cron jobs run as root (including CWP server updates) and end users from the dashboard. First, we’ll cover crontab for user root.
- Log into CWP.
- On the left, select Crontab for root under “Server Settings.” Active cron jobs will be listed at the top.
- Use “Common Cron Jobs” to quickly automate tasks to execute every, once, or twice a day, week, etc.
- Use “Add Custom Cron Jobs” to set more unique schedules, beneficial for ensuring two resource-intensive tasks don’t run concurrently.
- Use “Add Full Custom Cron Jobs” to type or paste a full cron job.
Crontab in User Panels
The cron job scheduler for regular users looks the same in the admin panel and user panel. The resemblance makes it easier to guide less experienced users remotely.
- Admin users, search for and select Crontab for users.
Regular users, select CWP Settings > Crontab.
- Select New cron, or Add new cron job for users.
- Type the command that will be executed in the cron job.
- Add a description to help you quickly understand what a job does without analyzing the code. Under this, Root users will have an additional drop-down menu to assign a user account to the cron job being created.
- Select a schedule for the cron job. Regular users will be shown the simple schedule options by default. Root users will be shown the advanced options by default.
- Save the cron job.
The page will refresh to list your new cron job. In the “Actions” column you’ll see buttons to run, deactivate, edit, and delete a cron job.
Verify Cron Jobs
There are three ways to check whether a cron job runs properly.
Admin users (and users with shell access) can use the following terminal command to search for part of the command, “clamscan” in this example, in the cron log file:
grep "clamscan" /var/log/cron
Root users have two additional routes to view the cron log in the admin panel. The recommended method for root users:
- Select File Management > CWP->Log Viewer.
- Under “Registry File,” select cron.
- Add a search term to filter unwanted results.
- Set the “Results lines” as necessary.
- Select Search.
Another option is File Management > Server Logs which opens the /var/log directory in the file manager.
Troubleshooting CWP Cron Jobs
Below are some basic tips to help you resolve problems if the verification methods don’t offer sufficient info.
Search the web server log (Apache, NGINX, Lighttpd, etc.) for errors that might’ve been recorded during the attempted execution.
Check the mail server log if an email is supposed to be sent via cron but isn’t being received correctly or at all. You may need to improve email authentication methods.
Modify commands to provide verbose error info if possible. Programming languages and web servers have various info that can help you figure out what’s wrong.
Check out our Support Center to learn more about CWP server management.