• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to schedule a CRON job to run a scripts on Ubuntu 20.4.1

  • 00:40 lsb_release -a
  • 01:00 crontab -l
  • 01:19 crontab -e
  • 02:00 cd /home/netaxis/Desktop/
  • 02:10 vim abc.sh
  • 02:33 chmod u+x abc.sh
{{postValue.id}}

To Schedule a CRON Job to Run a Scripts on Ubuntu 20.4.1

introduction:

The Cron is a Scheduling daemon that executes tasks at specified intervals. It reads the crontab (cron tables) for predefined commands and scripts.

Installation process:

Run lsb_release command to check the installed version of OS as follows.

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal

We assume that the crontab was installed on your machine. To view the installed cron job on your machine run the following command

root@linuxhelp:~# crontab -l
no crontab for root

Assign a cron job and run the following command.

root@linuxhelp:~# crontab -e
no crontab for root - using an empty one
Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic
  3. /usr/bin/vim.tiny
  4. /bin/ed
    Choose 1-4 [1]: 1
		
15 19 * * * /bin/sh  /home/Netaxis/Desktop/abc.sh
		

On Ubuntu based system it will ask for the editor for the first time to choose one or by default it uses the nano editor. Add the following lines, this will execute a “ abc.sh” script at 19:15PM Save and quit the file. Then create an abc.sh file on the desktop location.

root@linuxhelp:~# cd /home/Netaxis/Desktop/
root@linuxhelp:~/Desktop#  vim abc.sh

The below lines will create a file named file.txt , do not forget to the make the file executable.

root@linuxhelp:~# touch /home/Netaxis/Desktop/file.txt
root@linuxhelp:~/Desktop#  chmod u+x abc.sh

with this method scheduling a CRON job to run a scripts on Ubuntu 20.4.1 comes to end.

Tags:
connor
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

How to create a scheduled job in crontab?

A

To create a scheduled job in crontab use "*/3 * * * * "

Q

What is the minimum execution interval for cronjobs?

A

Every cronjob can be executed up to 60 times an hour, i.e. every minute.

Q

How to run the schedule using the crontab while rebooting the system?

A

For executing the scheduled job using the crontab while rebooting the system, use the following syntax as follow, "@reboot /root/reboot.sh"

Q

How to schedule the job using the crontab privileged by the specific user?

A

Here I have given the example executing the scheduled job using the crontab privileged under by the specific user "*/5 * * * * su username -c /opt/file.sh"

Q

How to redirect the output of the cron job into the specified file in Linux?

A

Use the following syntax to redirect the output of the cron job into the specified file in Linux. For syntax: "*/5 * * * * su admpinster -c /opt/cron.sh > /file/path"

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.