Creating a cron
Job
Schedule an automated task as a cron
job by editing a user's
crontab
file.
Any user can create a cron
job, but the location of the job definition
depends on the user's privileges.
An administrator who signs in as root
creates jobs that are stored in
/etc/crontab
. Jobs in /etc/crontab
are run as root,
unless the job definition specifies a different user.
Any user with administrator privileges can create system-wide cron
jobs.
The jobs are stored in /etc/crontab.d/
and the job file names include
the administrator's username.
A regular user can also create jobs that are stored in
/etc/crontab.d/
. The job file name also includes that user's name.
To create or edit a crontab
file as a signed in user, such as
jsmith
, follow these steps:
The cron
job is now active. To view and verify the contents of the new
cron
job, run the following command:
15 * * * * /home/jsmith/mybackup.sh
To delete the signed in user's crontab
file, run the following
command:
crontab -r
For more information, see the crontab(5)
manual page.