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?
- Ensure that you’re in the Webmin interface
- Select System
- Click Scheduled Cron Jobs
- Select the Create a new scheduled cron job button
- From the Execute cron job as dropdown select the user that you’d like to use to run the cron job
- This can be your current normal user or the root user
- Enter the command to run into the Command textbox
- For the purpose of this guide we’ll use the command echo Hello I’m being executed by a cron!
- 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
- Under When to execute select how often you’d like this command to run
- For the purpose of this guide we’ll set the command to execute 5 minutes past every hour
- Once you’re satisfied with the information that you’ve entered or selected click the Create button
- Once the cron is created you’ll be taken back to Scheduled Cron Jobs page
- To test the cron click on the newly created cron
- At the bottom of the page select Run Now
- You should now see a window similar to the following that contains the output of your cron
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!