Cron is used to execute scheduled commands. It acts as a task scheduler on Linux and UNIX systems which will execute commands at specified times set by the user. Cron has a great deal of customization and is often used on server environments where common tasks are run on a regular basis.

learn more… | top users | synonyms (2)

212
votes
4answers
404k views

Where is the cron / crontab log?

I want to verify if my cron job is executing and what time. I believe there is a log for my sudo crontab -e jobs, but where? I searched google and it I found references to look in /var/log ...
183
votes
33answers
272k views

Reasons why crontab does not work

Often, crontab scripts are not executed on schedule or as expected. There are numerous reasons for that: wrong crontab notation permissions problem environment variables This community wiki aims ...
162
votes
5answers
227k views

How do I set up a Cron job?

How do I add Cron jobs in Ubuntu?
51
votes
4answers
68k views

Where is the user crontab stored?

Since upgrading my user's crontab has been wiped out. This is not the first time this has happened this year and it's a pain restoring it each time. I'd like to be able to back up the crontab for my ...
41
votes
3answers
66k views

“(CRON) info (No MTA installed, discarding output)” error in the syslog

I have a fresh install of Ubuntu 12.04.1 LTS an a number of servers. I have not added any cron jobs or edited my crontab on those servers, however, at around the same time for each machine, I get a ...
41
votes
5answers
42k views

How are administrators supposed to read root's mail?

What is the Ubuntu way for system administrators to receive system notifications, which typically take the form of e-mail sent to the root account? Examples of such notifications are the output of ...
30
votes
3answers
55k views

How to run a cron job using the sudo command

Is it possible to run a cron job which needs the sudo command? Like: sudo rm somefile
25
votes
1answer
24k views

How do I make cron email my @gmail account

I have a couple of cron jobs that somethime produce error output and would like to get a notification in my "real" email account, since I don't use my user's mailbox in my Ubuntu laptop, but cron (or ...
20
votes
5answers
17k views

Changing default crontab editor

I am trying to change the default editor from nano to vim. I have run the following commands: sudo update-alternatives --config editor and update-alternatives --config editor Both now output: ...
18
votes
5answers
17k views

Cron.hourly won't run

Ok, So I've made my script, I dropped it in /etc/cron.hourly then I chmod 777 the file but it won't run (automatically). If I manually run it, it works fine. Do I need to do anything else?
17
votes
3answers
28k views

At what time does cron execute daily scripts?

If I place a shell script in /etc/cron.daily/, at what time of the day will it be executed?
16
votes
6answers
38k views

How do you set the timezone for crontab?

I have set up ACPI wakeup so my laptop wakes up at a certain time each morning. The timezone for this is UTC. I want to set up my crontabs also using UTC so they fit with the wakeup alarm. How do ...
15
votes
1answer
13k views

Add lines to cron from script

Is there a way to add lines to a user's cron via script? I usually do it using crontab -e, but I would like to automate this task with a shell script.
14
votes
7answers
70k views

How to run scripts every 5 seconds using cron?

I have a script that needs to be run every five seconds. I know that cron can do tasks by the minute, but is there a way to run something every second?
12
votes
3answers
30k views

How to execute command every 10 seconds (without cron)?

When I execute cron I get this fault cron: can't open or create /var/run/crond.pid: Permission denied So, how to do it without cron? P.S. I want to check if file in svn has changed and I have a ...
12
votes
2answers
64k views

Script doesn't run via crontab but works fine standalone

I have a script that reminds me to restart my computer if uptime is more than, say 3 days (although its set to 0 days now just to check if the script is running as my computer has been up only over a ...
12
votes
1answer
2k views

What is the story behind the default times set in /etc/crontab?

To my understanding, this is the default configuration of /etc/crontab: # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * ...
11
votes
3answers
8k views

Can symlinks be used in /etc/cron.d/?

I'm trying to implement a configuration mechanism that allows in a certain project to deploy through svn a cron configuration. I immediately thougt that what I should do is cerate symlinks from ...
11
votes
4answers
6k views

Generic solution to prevent a long cron job from running in parallel?

I am looking for a simple and generic solution that would allow you to execute any script or application in crontab and prevent it from running twice. The solution should be independent on the ...
10
votes
4answers
11k views

Why does apt-get fail when automated with cron?

I'm trying to use cron to automate my system updates. You can see my crontab, commands, and resulting errors below. When I run upgrades.sh as root, the script runs fine. When cron runs it, apt-get -y ...
10
votes
2answers
962 views

How to schedule time-of-day upgrades

I'm responsible for about 30 Ubuntu computers at a private K-8 school. We have only a 3Mbps internet connection serving the entire campus, and I would like to ensure that updates are done in the ...
9
votes
3answers
34k views

How can I tell if my hourly cron job has run?

I have created a file called ntpdate in /etc/cron.hourly #!/bin/sh /usr/sbin/ntpdate-debian date > /tmp/william_tmp date > /william_tmp date > ~/william_tmp echo test I also did Chmod 755 ...
9
votes
3answers
24k views

Cron Job Not Running?

I have a crontab file that looks like this: * * * * * /home/abliskovs/update/update.sh However when I check the syslog for evidence that the job has run, there is nothing that might indicate that it ...
9
votes
4answers
7k views

What kind of harm there is from removing (purging) package apt-xapian-index?

I know you can't use Quick filter in Synaptic after purging apt-xapian-index, but is there something more severe? I know there are some performance issues, when you have it: ...
9
votes
2answers
11k views

All commands in my crontab fail with “Permission denied”

crontab -e and crontab -l work just fine: $ crontab -l | grep -v '^#' * * * * * /usr/bin/env * * * * * echo 'Hello from crontab' However, I see two messages like this every minute in ...
8
votes
4answers
21k views

How to restart every 30 minutes automatically?

I would like to schedule a restart of my Ubuntu every 30 minutes. Is there any command or a graphical way to do it?
8
votes
4answers
39k views

Verify if crontab works

I want to verify if a certain crontab works properly. I have added a job like this: */2 * * * * /path_to_my_php_script/info.php >/dev/null 2>&1 I know that i redirect to the null ...
8
votes
3answers
14k views

How can I setup a Mail Transfer Agent?

I intend to use mutt to send automated emails via cron or at with attachments to my gmail address when particular events happen on my Ubuntu server. Currently, mutt cannot send email to external ...
8
votes
4answers
5k views

“Backup Intervals” in rsnapshot.conf?

A simple question about rsnapshot. In order to perform daily backups I'm going to add lines to cron in my Ubuntu. Then, why do I have also these lines in the rsnapshot.conf ? ...
8
votes
2answers
7k views

Why do I see a CRON session opening and closing every hour in /var/log/auth.log?

I am quite fresh with Linux as a whole, so this may be a silly question - but I would still like to know the answer This morning when I look at my /var/log/auth.log (which I've been told to make a ...
8
votes
2answers
2k views

what can be causing /etc/cron.daily/apt to hang?

Lately I've been getting a mail from the server every day, Subject Cron <root@host> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) Body ...
7
votes
5answers
4k views

Notify-send doesn't work from crontab

I made a script that should notify me when there's a new chapter of manga that I'm reading. I used the command notify-send to do this. The program works when I am trying to run it in terminal. The ...
7
votes
2answers
31k views

How can I see/stop current running crontab tasks?

How can I see crontab tasks which are in progress? How can I stop crontab tasks which are in progress, manually? Is [this] question about see the current running cron processes? Yes To ...
7
votes
2answers
18k views

How to stop email report from Cron <root@machine> (hourly)

I'm running an Ubuntu 12.04, I've configured "ssmtp" with my gmail account and now I'm getting every hour an email with a report, this is an example: From: root <my@gmail.com> Date: 2012/8/13 ...
6
votes
5answers
10k views

cron.daily jobs not running

I created 3 daily cron jobs to run. Below are the three that are placed in etc/cron.daily rkhunter.sh #!/bin/sh ( rkhunter --versioncheck rkhunter --update rkhunter --cronjob --report-warnings-only ...
6
votes
3answers
11k views

Daily cron job not running

A quick overview: I have a script that will daily backup my source code repository from SVN into a tarball for that day. I have tested the script and it works very well as long as I run it as sudo, ...
6
votes
2answers
3k views

Keep getting mails about xdebug

I'm running Oneiric as a LAMP development server, and have xdebug installed. It works fine, but since I set up my email so that root mails are forwarded to my gmail, I keep getting the following: ...
6
votes
2answers
787 views

How to start a GUI application from cron?

I need to run a Java applet from a Firefox. The problem is, I need to run this Firefox from a cron. If I run from the command line and its work fine, but when put the command in the cron it failed: ...
6
votes
2answers
3k views

How to run a script only once per day with cron without specifying execution time

I wan to run a backup script once per day but i dont want to specify a certain time, just once per day. I've read that the @daily cron attribute runs every day at 00:00 but i don't know if the ...
6
votes
5answers
10k views

What's wrong with my cron.hourly configuration?

Every hour I get an email with error like this, Subject: Cron <root@supa> root cd / && run-parts --report /etc/cron.hourly /bin/sh: root: not found Contents of /etc/crontab is as ...
6
votes
1answer
418 views

Schedule to record video stream in VLC

I work at a school and have setup a workstation to broadcast/stream the morning announcements for the teachers and kiddos. Teachers in the classroom access this stream via Windows Media Player or ...
6
votes
2answers
7k views

What is my crontab -e local file path? I want to set it via BASH script

In my Ubuntu, my username is "meuser". When i do crontab -e, i can setup my rules. But instead of doing it with crontab -e, how can i do it directly to a file? Which file i cant modify?
6
votes
1answer
2k views

Schedule sending mail of a log file content

I have postfix mail agent installed and I've configured gmail relay and I could send mails from the terminal as below: root@statino1:~# mail -s "subject_here" my_gmail_id@gmail.com CC: <hit enter ...
6
votes
3answers
4k views

Why is this rsync + ssh cron job giving me 'Permission denied (publickey)' errors?

I make frequent backups to a local drive which I want to sync daily to a remote server. The target server is configured for SSH key (no password) access only. Since my primary SSH key for that server ...
5
votes
2answers
10k views

How to run crontab as user:www-data?

My LAMP is setup to work as user:www-data and all files and folders are created with that permissions. I have setup for crontab as user@ubuntu. So i do crontab -e and use this command: */5 * * * * ...
5
votes
3answers
2k views

Need help with bash checking if computer uptime is greater than 5 minutes

I have an bash script that runs on a every minute cron. It checks to see if a necessary program is running and starts it if it is not. Occasionally it will run before the user has actually autologged ...
5
votes
4answers
9k views

Setup CRON weekly backup

I want to make a backup of my /var/lib/mysql and /var/www folders and save them as tar.gz files to my mounted network file server (uslons001). Here is my bash file located in: ...
5
votes
3answers
2k views

Programmatically sync dropbox without daemon running

I would like to 'manually' force dropbox to sync at certain times (eg at regular, daily intervals using cron, as part of a larger backup script). My goal is to substitute the dropbox daemon with ...
5
votes
1answer
5k views

How to start / stop Dropbox at a specific time

I have setup a service on my Ubuntu 10.04.4 LTS server, which works when started and stopped manually using sudo service <service> start etc. However I would like to have the service (dropbox ...
5
votes
1answer
710 views

What is the easiest way to set up a cron job?

Every time I set up a cron job there is something wrong with it and I spend a lot of time trouble shooting it. I use Ubuntu and I would like to know what tools exist to make my life easier when ...