How to Create a Cron Job (Virtualmin)

One very cool and handy tool in any server admin’s arsenal is the power of automation, as it can allow an admin to do more with less. In Linux, setting a cron job is a great way to automate a very specific task or many tasks via a script on a recurring scheduled basis. However, this would have to be set using a few commands from the Linux shell (command line). Well… with Virtualmin on your side you can create a cron job using a user friendly graphical interface in no time at all! The focus of this article is to teach you how to create a cron job in Virtualmin using the wonderful GUI. This article implies that you have already installed Virtualmin. If you havn’t done so yet, please take a look at the following article: How to install Virtualmin (CentOS 7).

 

Before we get started you’ll need to login to your Webmin account. If you’re not certain how to do this please review the following article, which should assist you with logging in: How to login to Webmin. Once you’ve logged in please proceed with the following steps to setup a cron job in Virtualmin.

How do I create a cron job using Virtualmin?

 

  1. Ensure that you’re in the Webmin interface
  2. Select System
  3. Click Scheduled Cron Jobs

 

Showing the location of Scheduled cron jobs in Virtualmin

 

  1. Select the Create a new scheduled cron job button

 

Showing the create a new scheduled cron job button in Virtualmin

 

  1. From the Execute cron job as dropdown select the user that you’d like to use to run the cron job
    1. This can be your current normal user or the root user
  2. Enter the command to run into the Command textbox
    1. For the purpose of this guide we’ll use the command echo Hello I’m being executed by a cron!
  3. You can generally skip the Input to command textbox as that’s typically only used if the command the cron is executing requires input after it begins
  4. Under When to execute select how often you’d like this command to run
    1. For the purpose of this guide we’ll set the command to execute 5 minutes past every hour

 

Showing execute settings in Webmin when you create a cron job

 

  1. Once you’re satisfied with the information that you’ve entered or selected click the Create button

 

Showing the Create button when you create a cron job in Virtualmin

 

  1. Once the cron is created you’ll be taken back to Scheduled Cron Jobs page
  2. To test the cron click on the newly created cron
  3. At the bottom of the page select Run Now

 

Showing the Run Now button in Virtualmin to test newly created cron jobs

 

  1. You should now see a window similar to the following that contains the output of your cron

 

Showing an example output from scheduled cron jobs in Virtualmin

 

If you followed this guide successfully you should now have a fully functioning cron job setup and ready to do your bidding while you handle other tasks!


Share:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.