Control Web Panel (CWP) Cron Jobs

Cron Jobs in Control Web Panel

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

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. 

  1. Log into CWP.
  2. On the left, select Crontab for root under “Server Settings.” Active cron jobs will be listed at the top.
    Control Web Panel (CWP) crontab in admin panel
  3. Use “Common Cron Jobs” to quickly automate tasks to execute every, once, or twice a day, week, etc.
  4. Use “Add Custom Cron Jobs” to set more unique schedules, beneficial for ensuring two resource-intensive tasks don’t run concurrently.
  5. 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. 

  1. Admin users, search for and select Crontab for users.
    Regular users, select CWP Settings > Crontab.
  2. Select New cron, or Add new cron job for users.
  3. Type the command that will be executed in the cron job.
    Control Web Panel (CWP) crontab in a user panel
  4. 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.
  5. 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.
  6. 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
Checking cron log

Root users have two additional routes to view the cron log in the admin panel. The recommended method for root users:

  1. Select File Management > CWP->Log Viewer.
  2. Under “Registry File,” select cron.
  3. Add a search term to filter unwanted results.
  4. Set the “Results lines” as necessary.
  5. Select Search.
Control Web Panel (CWP) cron log viewer

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.

No matter if you’re a developer, system administrator, or simply a fan of SSH and command line, InMotion’s Cloud VPS plans provide a fast, scalable environment that is budget-friendly.

Comments

It looks like this article doesn't have any comments yet - you can be the first. If you have any comments or questions, start the conversation!

Was this article helpful? Let us know!