Questions tagged [crontab]

Crontab is a short form of cron table. It is a configuration file that specifies shell commands to run periodically on a given schedule.

307 questions
74
votes
7 answers

Run a command every week with Cron?

Simple question- what would a crontab entry look like for a command I want to run every week on Saturday at 8:05 AM?
igul222
  • 993
  • 1
  • 8
  • 8
58
votes
1 answer

Running program every 2 minutes with crontab

What does 2 * * * * means in crontab context? I want to run my program every 2 minutes; is that what 2 * * * * means?
Juanjo Conti
  • 840
  • 1
  • 8
  • 11
54
votes
2 answers

Difference between /etc/crontab and "crontab -e"

What is the difference between the crontab located in /etc/crontab and the crontab that can be edited using crontab -e?
jrdioko
  • 10,865
  • 5
  • 24
  • 26
43
votes
14 answers

Run a cron job on the first Monday of every month?

I'd like to run a job from cron at 8.30 on the first Monday of every month. The cron Wikipedia page says While normally the job is executed when the time/date specification fields all match the current time and date, there is one exception:…
Max Williams
  • 2,589
  • 6
  • 28
  • 36
30
votes
7 answers

How to execute shell script via crontab?

I have a notify.sh script that looks like: notify-send "hi welcome" My crontab notification for 2 PM: 0 14 * * * home/hacks/notify.sh However, this doesn't work. What is the problem?
Aravind
  • 521
  • 1
  • 5
  • 8
18
votes
2 answers

Run a cron job every 5 minutes between two times

Is there a way to specify a job that runs every 5 minutes between some start time and some end time on business days in a crontab? Update I think it's relevant that my start and end times are not at round hours. So, specifying 9-5 in the hour…
pythonic metaphor
  • 2,246
  • 6
  • 22
  • 30
17
votes
4 answers

Is it possible to use variables in crontab -e?

Can I say: MYPATH=/root/scripts MYSCRIPT=doit.sh 0 1 * * * $MYPATH/$MYSCRIPT in crontab -e? Is it possible to use variables in crontab -e?
user19496
  • 1,400
  • 3
  • 12
  • 22
16
votes
1 answer

crontab day of week vs. day of month?

I added this to /etc/crontab on a few different linux & freebsd systems: # monthly reboot: 3rd Tuesday of every month 56 07 15-21 * 2 root /sbin/shutdown -r now I want a reboot on the 3rd TUESDAY of every month. However, all the systems rebooted…
ane
  • 163
  • 1
  • 1
  • 5
16
votes
2 answers

Cron runs only once instead every minute

I'm trying to run a script every minute (on a Docker container running Ubuntu 16.04). The /etc/echo.sh simply echo the word "hi" cat /etc/crontab * * * * * root /etc/echo.sh > /var/log/cron.log 2>&1 /etc/init.d/cron reload * Reloading…
Sig
  • 491
  • 1
  • 4
  • 13
15
votes
1 answer

crontab and binaries in /usr/local/bin

I am working in Redhat and have few programs located in folder /usr/local/bin I would like to call from crontab for root user. I thought that by putting binaries in that folder would be sufficient to call the program directly as in the…
Abruzzo Forte e Gentile
  • 1,615
  • 4
  • 17
  • 19
15
votes
2 answers

Multiple crontabs for one user

is there a way to use multiple crontab files for one user? Thinking something along the lines of crontab file per project instead of crontab per user... Any help is appreciated...
realshadow
  • 251
  • 1
  • 2
  • 5
11
votes
1 answer

Linux - check when crontab file was last amended

How can i get the last updated date/time of the crontab file. not when cron was last run but instead when was the crontab file amended last
Marty Wallace
11
votes
2 answers

Where is my crontab file on OS X?

Moving to a new laptop I've lost my old cron setup. I'd like to include it in my backup going forward. Where is it located?
Thomas David Baker
  • 213
  • 1
  • 2
  • 6
10
votes
5 answers

Bad minute in crontab?

I get the following error in my syslog: Oct 17 13:14:03 tracker cron[873]: (*system*) ERROR (Syntax error, this crontab file will be ignored) Oct 17 13:14:03 tracker cron[873]: Error: bad minute; while reading /etc/crontab I don't see any bad…
David Pfeffer
  • 573
  • 2
  • 5
  • 20
10
votes
1 answer

Cronjob runs before the scheduled time, what could be wrong?

I have below crontab scheduled for Saturday that falls between days 19-23, I' m not sure why it ran on 20th (Friday). Any guesses? 00 21 19-23 * 6
simer
  • 153
  • 8
1
2 3
20 21