How to Setup a Cron Job on Webmin

How to Setup a Cron Job on Webmin

Cron job is one of the best ways to automate various daily, weekly or even monthly tasks. Cron jobs are widely used these days because doing the same things manually over and over again is time-consuming and inefficient. In this tutorial, we will learn how to set up a cronjob on a server which runs Webmin.

What you’ll need

Before you begin this guide you’ll need the following:

  • A working server / VPS with Webmin installed
  • Access to your Webmin admin panel

Step 1 — Accessing cron job configuration section in Webmin

  1. Login to your Webmin admin panel. You can usually do this by typing https://your-vps-ip-adress:10000 (replace your-vps-ip-address with the dedicated IP address of your server) into your browser.
  2. Choose Webmin between two options at the top of the left sidebar.
    Webmin location
  3. Find and click System tab in the left sidebar of Webmin and navigate to Scheduled Cron Jobs.
    Scheduled cron jobs location
  4. You should now be able to see a window with all of your scheduled cron jobs. Usually, it is filled with many default cron jobs of Webmin or other services. If you see a page like this, you are in the correct place.
    Cron jobs list

Step 2 — Creating a new cron job

  1. Click Create a new scheduled cron job listed at the top of the cron job list.
    Create new cron job location
  2. In the next page, you will need to configure your cron job. The first section is called Job Details. Here you will need to configure:
    • Execute cron job as – you need to select which UNIX user should execute the cron job. By clicking the button on the right side from the field, you will get a full list of all available users on the server.
    • Active? – You can select whether your cron job should be active or not right after creation. You can surely change this setting later if, for example, you want to only activate the cron job later and not instantly upon creation.
    • Command – Here you will need to write command you want to run periodically. In this example, I am running a shell script so I only filled in the path of the file I want to execute. But you can write any command you like.
    • Input to command – This field will be fed to the command as input when cron job is executed. If, for example, your command was mail , input entered into the field would be sent to that email address. (Note: this field is optional)
    • Description – your own cron job description (it is not required) for self-reference.
      Job Details
  3. Next section on this page is called When to execute. Here you will be able to select when your cron job should be executed. There are two options:
    • Simple schedule – you can select an already defined interval from the drop down list.
      When to execute simple
    • Times and dates selected below – If you choose this option, you will have to configure the cron job execution times manually by selecting minutes, hours, days, etc. from the lists below.
      When to execute advanced
  4. The last section is called Date range to execute. In this section, you can set a date interval if you only need your cron job to run for a week/two weeks or any other time period.
    • Select Run on any date if you want the cron job to be active until you disable it.
    • Select Only run fromto … and fill in exact dates if you want to set a date interval for the cron job to be active.
      Date range to execute
  5. When you have everything configured as you want, scroll down to the bottom of the page and click Create.
    Create location
  6. If the cron job was setup successfully, You will see it in the list of cron jobs:
    Success setting up cron job


You have learned how to setup a cron job on server/VPS running Webmin. Cron jobs will surely improve your efficiency by automating various tasks you had previously executed manually.

The author

Linas L.

Linas started as a customer success agent and is now a full-stack PHP developer at Hostinger. He is passionate about making a positive impact on people by utilizing user-driven development techniques. As much as he enjoys coding and changing the world, he secretly dreams of becoming a rock star.