Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a cron job without crontab [closed]

Tags:

linux

cron

Is it possible to add a cronjob without using the crontab command? (Or anything else except editing files directly.) Is there a file I need to edit?

like image 767
Darkwater Avatar asked Apr 05 '13 08:04

Darkwater


People also ask

Do I need to restart cron after adding a job?

If edited file /var/spool/cron/crontabs/root via console linux (nano, mc) - restart NOT needed. If edited cron via crontab -e - restart NOT needed.

What happens to cron if computer is off?

cron jobs run while the computer is on & not sleeping, so it will run in situations 1 and 2. If the computer is off or asleep at the job's scheduled time, it does not do any sort of catch-up run later when the computer restarts/wakes up; therefore, it will not run in situation 3.

What does 30 * * * * mean in crontab?

*/30 * * * * your_command. this means "run when the minute of each hour is evenly divisible by 30" (would run at: 1:30, 2:00, 2:30, 3:00, etc)


1 Answers

You can directly edit the following files:

/etc/crontab
/etc/cron.d/*
/etc/cron.{hourly,daily,weekly,monthly}/*

These are system-wide files. In these files you must specify a username before the command to be executed.

In contrast, per-user crontabs are stored here: /var/spool/cron/<username>

like image 95
Madox Avatar answered Sep 23 '22 01:09

Madox