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.

315 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
59
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
  • 850
  • 2
  • 8
  • 11
57
votes
18 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,917
  • 6
  • 29
  • 38
57
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
  • 12,445
  • 5
  • 27
  • 26
35
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
  • 601
  • 1
  • 7
  • 8
19
votes
5 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,490
  • 3
  • 13
  • 22
18
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,725
  • 5
  • 17
  • 21
18
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
  • 521
  • 1
  • 4
  • 13
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,306
  • 6
  • 23
  • 30
17
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
  • 173
  • 1
  • 1
  • 5
16
votes
2 answers

Can I specify a specific time with seconds with Linux crontab?

49 18 * * * mpv ~/Musik/Donau.mp3 This command would play the Donau.mp3 file at exactly 6:49pm. How could I, for example, specify 6:49:50pm?
Peter Andres
  • 196
  • 1
  • 9
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
14
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
  • 243
  • 1
  • 2
  • 6
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
1 answer

use multiple @reboot commands in crontab

I searched this website and Google but couldn't find it.. How can I execute two (or more) commands using @reboot ? What I have now: @reboot /root/website1/starter.sh What I want: @reboot /root/website1/starter.sh @reboot…
Henry
  • 211
  • 1
  • 2
  • 4
1
2 3
20 21