Home Cron Jobs How To Easily And Safely Manage Cron Jobs Using Crontab UI In Linux

How To Easily And Safely Manage Cron Jobs Using Crontab UI In Linux

By sk
Published: Updated: 13.2K views

When it comes to schedule tasks in Linux, which utility comes to your mind first? Probably, Cron! The cron utility helps you to schedule commands/tasks at specific time in Unix-like operating systems. We already published a beginners guides to Cron jobs. I have a few years experience in Linux, so setting up cron jobs is no big deal for me. However, the newbies may not know how to properly set Cron jobs. A newbie user may unknowingly do small mistake while editing plain text crontab and bring down all cron jobs. Just in case, if you think you might mess up with your cron jobs, there is a good alternative way. Say hello to Crontab UI, a web-based tool to easily and safely manage cron jobs in Linux operating systems.

What Is Crontab UI?

Crontab UI allows you to easily create, edit, pause, delete, backup cron jobs and also import, export and deploy jobs on other machines without much hassle.

You don't need to manually edit the crontab file to create, delete and manage cron jobs. Everything can be done via a web browser with a couple mouse clicks.

Error log, mailing and hooks support also possible. Crontab UI is free, open source and written using NodeJS.

Install Crontab UI In Linux

Installing Crontab UI is just a one-liner command. Make sure you have installed NPM. If you haven't install npm yet, refer the following link.

Next, run the following command to install Crontab UI.

$ npm install -g crontab-ui

It's that simple. Let us go ahead and see how to manage cron jobs using Crontab UI.

Manage Cron Jobs With Crontab UI

To launch Crontab UI, simply run:

$ crontab-ui

You will see the following output:

Node version: 10.8.0
Crontab UI is running at http://127.0.0.1:8000

Now, open your web browser and navigate to http://127.0.0.1:8000. Make sure the port no 8000 is allowed in your firewall/router.

Please note that you can only access Crontab UI web dashboard within the local system itself.

If you want to run Crontab UI with your system's IP and custom port (so you can access it from any remote system in the network), use the following command instead:

$ HOST=0.0.0.0 PORT=9000 crontab-ui
Node version: 10.8.0
Crontab UI is running at http://0.0.0.0:9000

Now, Crontab UI can be accessed from the any system in the nework using URL - http://<IP-Address>:9000.

This is how Crontab UI dashboard looks like.

Crontab ui dashboard
Crontab UI Dashboard

As you can see in the above screenshot, Crontab UI dashboard is very simple. All options are self-explanatory.

To exit Crontab UI, press CTRL+C.

Create, Edit, Run, Stop, Delete Cron Jobs

To create a new cron job, click on "New" button. Enter your cron job details and click Save.

  1. Name the cron job. It is optional.
  2. The full command you want to run.
  3. Choose schedule time. You can either choose the quick schedule time, (such as Startup, Hourly, Daily, Weekly, Monthly, Yearly) or set the exact time to run the command. After you choosing the schedule time, the syntax of the cron job will be shown in Jobs field.
  4. Choose whether you want to enable error logging for the particular job.

Here is my sample cron job.

Create new cron job
Create a new cron job

As you can see, I have setup a cron job to clear pacman cache at every month.

Similarly, you can create any number of jobs as you want. You will see all cron jobs in the dashboard.

Cron Jobs in Crontab UI dashboard
Cron Jobs in Crontab UI dashboard

If you wanted to change any parameter in a cron job, just click on the Edit button below a cron job and modify the parameters as you wish.

To run a job immediately, click on the button that says Run. To stop a job, click Stop button. You can view the log details of any job by clicking on the Log button. If the job is no longer required, simply press Delete button.

Backup Cron Jobs

To backup all cron jobs, press the Backup from main dashboard and choose OK to confirm the backup.

Backup cron jobs
Backup cron jobs

You can use this backup in case you messed with the contents of the crontab file.

Import/Export Cron Jobs To Other Systems

Another notable feature of Crontab UI is you can import, export and deploy cron jobs to other systems. If you have multiple systems on your network that requires the same cron jobs, just press Export button and choose the location to save the file. All contents of crontab file will be saved in a file named crontab.db.

Here is the contents of the crontab.db file.

$ cat Downloads/crontab.db 
{"name":"Remove Pacman Cache","command":"rm -rf /var/cache/pacman","schedule":"@monthly","stopped":false,"timestamp":"Thu Aug 23 2018 10:34:19 GMT+0000 (Coordinated Universal Time)","logging":"true","mailing":{},"created":1535020459093,"_id":"lcVc1nSdaceqS1ut"}

Then you can transfer the entire crontab.db file to some other system and import its to the new system. You don't need to manually create cron jobs in all systems. Just create them in one system and export and import all of them to every system on the network.

Get The Contents From Or Save To Existing Crontab File

There are chances that you might have already created some cron jobs using crontab command. If so, you can retrieve contents of the existing crontab file by click on the "Get from crontab" button in main dashboard.

Retrieve cron jobs from crontab file
Retrieve cron jobs from crontab file

Similarly, you can save the newly created jobs using Crontab UI utility to existing crontab file in your system. To do so, just click Save to crontab option in the dashboard.

Uninstall Crontab UI

If you don't like or don't use Crontab UI anymore, remove it using command:

$ npm uninstall -g crontab-ui

Conclusion

Managing cron jobs using Crontab UI is not that complicated. Any newbie user can easily maintain any number of jobs without much hassle with the help of Crontab UI. Give it a try and let us know what do you think about this tool in the comment section below.

Resource:

You May Also Like

4 comments

B.Mulder January 16, 2020 - 2:52 am

I was using crontab-ui. For an activity each 6 seconds I used 0.1 minutes instead of 0,1 minutes. After that I could not use crontab-ui anymore. I deleted the expression.js file. Can’t restart it anymore and also reinstalling was not working. How can I delete the total app, reinstall it again, or correct the mistake? Thanks.

Reply
sk January 16, 2020 - 12:04 pm

To uninstall, run:

$ npm uninstall -g crontab-ui

I added the uninstallation note in the guide.

Reply
S July 6, 2021 - 11:34 pm

Hi

I have tried to use this to run a .php script and it just does….well nothing. No error messages but also no action on the file associated with the php script.

Is there a secret to running php.?

I use Fedora 34

Cheers

Reply
sk July 6, 2021 - 11:59 pm

That’s odd. It worked for me at the time of writing this guide. Please file an issue in the official github page -> https://github.com/alseambusher/crontab-ui/issues

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

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

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More