Task Manager (crontab, at)
📝 Note: The majority of the following commands must be run by the superuser @root
Part 1: Using the crontab
Command
crontab
CommandThe crontab
command is used to schedule commands to be executed periodically. It allows tasks to be automatically run in the background at regular intervals.
That means that you can use crontab
to automatically create backups, synchronize files, schedule updates, and much more.
The main configuration file for cron is /etc/crontab
. If you view the content of it, it will display:
List programmed tasks
It will list the crontabs that are currently running on your environment, if you are a
root
user, you can list all the crons that the system has.If you have not set any jobs, it will display a message such as
crontab: no crontab for user
.Edit the list of cronjobs
The option
e
let you edit a list of tasks. You can set some tasks using this format:
Part 2: Using the at
Command
at
CommandUse at
when you want to execute a command or multiple commands once at some future time.
The at
command takes input up to the end-of-file character (ctrl
D
while at the beginning of a line). It reports the job number and informs you that it will use /bin/sh
to execute the command. An email to raithel will be sent at 4:55pm on Friday with the Subject: '5 p.m. meeting with Carol'.
To program a script from now
, you may add hours, minutes, or seconds with the +
symbol, e.g.:
This script will notify you with a beep in 25 minutes.
To get a list of your pending at jobs, enter
atq
. If you are superuser,atq
shows you the pendingat
jobs of all users.To delete a job, enter
atrm job_number
wherejob_number
is the job number returned byatq
. The superuser can also remove other user's jobs.
Last updated