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)

126
votes
5answers
164k views

How do I set up a Cron job?

How do I add Cron jobs in Ubuntu?
148
votes
31answers
213k views

Reasons why crontab does not work [closed]

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 ...
37
votes
5answers
35k 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 ...
163
votes
3answers
299k 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 ...
22
votes
3answers
40k 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
7
votes
3answers
12k 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 ...
7
votes
4answers
5k 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: ...
24
votes
4answers
36k 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 ...
13
votes
5answers
14k 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?
2
votes
1answer
626 views

Schedule to turn off monitor via crontab?

I want to turn off monitor on a specific period of time automatically (for example between 07:00 and 11:00). Is there any command to be set in crontab file? Is there any better way? In summary: ...
4
votes
5answers
6k 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 ...
0
votes
2answers
545 views

Set server timezone but not working with crontab and phpmyadmin

TimeZone is not working properly I am using linode server running ubuntu 12.04LTS. My Question is when i configured timezone by using dpkg reconfigure tz as IST ASIA/Calcutta. It shows correct ...
17
votes
5answers
14k 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: ...
11
votes
3answers
21k 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 ...
4
votes
3answers
3k views

unattended-upgrades not running, /etc/cron.daily/apt missing

I have automatic-upgrades installed and configured, but it never seems to run, because there are always security updates waiting to be installed when I check. ...
10
votes
2answers
50k 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 ...
8
votes
4answers
9k 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 ...
6
votes
2answers
6k 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?
4
votes
1answer
1k views

Hourly GIT Push

Is it possible for me to automate a Git push every hour via a batch script. I would typically type in this: git add * git commit -m "latest update" git push ...
3
votes
2answers
3k views

How can I set up a php script to run via cron?

How can I set up a php script to run via cron I've created a file in the cron.d folder with the username as the file name: /etc/cron.d/username Inside of username file I placed the following cron ...
3
votes
4answers
4k views

execute script after desktop loaded?

I want to execute bash script on startup that opens several terminals in different workspaces. Script works just fine if I call it from terminal, but it doesn't work if executed from crontab using ...
2
votes
3answers
11k views

How do I configure exim4 to send mail through a password protected ssl smtp mail server?

I'd like my cronjobs to be able to send mail from my home computer. My servers configure exim4 like this: dc_eximconfig_configtype='internet' dc_other_hostnames='' dc_local_interfaces='127.0.0.1' ...
12
votes
1answer
1k 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 * * * ...
7
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 ...
5
votes
3answers
10k 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, ...
4
votes
2answers
13k 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 ...
4
votes
6answers
3k views

How to run cron job when network is up?

I have some anacron jobs which run daily. The scripts update local bzr and git repositories. Naturally these scripts need working network connections. I'm on a laptop and often wired and wireless ...
3
votes
2answers
2k views

Automating duplicity backups using cron

How do I automate duplicity backups using cron using gpg encryption and the ssh backend?
2
votes
2answers
919 views

Setting cron to run a shell script: random wallpaper from a webpage

I have written a shell script which downloads random wallpaper from a web-page and sets it as a background every 5 hours. Here is the script: #!/bin/bash countervar=1; finish=0; cd ...
1
vote
1answer
4k views

Crontab Shut down command didn't work

I wanted Crontab shut down the system daily but it didn't do so, did I misspelled something? This is my Crontab file: /etc/crontab: system-wide crontab Unlike any other crontab you don't have to ...
0
votes
4answers
8k views

How to Setup a root cron Job Properly

I tried to setup a root cron job to run a Bash script as root, to run at minute 7,37, every hour, every day of month, every month. This script is located in /usr/bin and named tunlrupdate.sh is used ...
0
votes
2answers
1k views

How to append text to file every morning?

I would like to append current date to text file every morning at 7am. if the computer is turned off I would like it to be executed after its turned on.
8
votes
3answers
27k 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 ...
6
votes
5answers
9k 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 ...
4
votes
1answer
285 views

Is it possible to use the 'screen' command to work with files on an encrypted home directory?

So I have an encrypted home directory, set up during install on a server running Ubuntu 12.04 LTS. I attempted to use screen in order to run a script that accesses the data in my home directory after ...
4
votes
1answer
2k views

Why does my computer shuts down itself every morning at 6 AM?

My computer shuts down by itself at a specific time everyday 6:00am. I can't find what's causing it. I'm a long time Windows user and just recently tried Ubuntu. So I don't know anything about Linux ...
3
votes
1answer
868 views

Is there a programmable way to tell if the screen is locked?

I have lots of stuff in my crontab, including some that talks to my screen. If I'm not there for it to be notifying, I don't really want it to run. Is there a way I can check to see if the computer ...
2
votes
2answers
5k views

Getting output from a cron job on the terminal

I have a program that prints some output that I would like to pop up on my terminal once every hour during the workday. $ crontab -l 0 07-17 * * * /home/dat/scripts/cron.out syslog reports the ...
2
votes
2answers
3k views

Stop cron from mailing the user

I am facing an issue with Ubuntu server. I am running a PHP script using a cron job which executes every 5 minutes. This folder spool/mqueue is showing 112GB space. The scripts job is to fetch data ...
2
votes
1answer
6k views

Add cron job on startup from a script

I would like to add a command to be run at startup from within a shell script. For example, I run the script once and it adds the cron job, so from that time on, each time the OS starts, a specific ...
2
votes
2answers
377 views

add cron job to foreground

I am trying to run a program that pops up a graphical notice to me. As a simple example, I have my cron settings as @hourly xlogo and if I launch xlogo from an interactive command, it works fine. ...
2
votes
1answer
742 views

cron.weekly does not run

I have a shellscript in /etc/myprog/myscript.sh that I would like to run every week. Therefore I created a symbolic link in /etc/cron.weekly: root@ip-10-190-199-197:/etc/cron.weekly# ls -ltr total 8 ...
2
votes
1answer
2k views

Is it safe to uninstall anacron?

I have my desktop system running continually without shutdown and I want to get normal times (3:01, 4:15, 5:30) for cron.(daily|weekly|monthly) jobs but when anacron is installed these jobs run at ...
2
votes
2answers
337 views

Is it possible to schedule the downloads required to upgrade?

I'd like to upgrade from 10.10 to 11.04 but my ISP has a data-cap, limiting the amount I can download. Thankfully, traffic between 2am and 8am doesn't count towards this cap, but I'm seldom awake at ...
1
vote
3answers
1k views

(Xubuntu) How to set the wallpaper using the command line?

I've done a lot of googling but haven't been able to find a solution to my problem. I am a teacher and I'm using Xubuntu on some student computers. I have everything locked down pretty good, but I ...
1
vote
1answer
364 views

Kill a cron job from cron

I want to start the ubuntu update at night because internet is free at that time. and then kill the process in order to ensure that it does not download anything after 7:00 AM. Is there any way to ...
1
vote
2answers
2k views

Auto shutdown server if there was no activity

My server should shutdown after 01:00 am, if there was no activity in the past hour. Lets say there was the last connection at 00:43 then it should check again at 01:43. How to write such a ...
0
votes
3answers
57 views

Run rkhunter regularely on a desktop system

I want to get a warning on my desktop when rkhunter finds something odd on my system. I whitelisted some files and dirs that seem ok in /etc/rkhunter.conf so I get no warnings anymore. Now I want to ...
0
votes
1answer
82 views

How can I configure a second SSH key + user for a single server?

I have a SSH key which is passphrase-protected. Authentication to the server is by SSH key only, password authentication is disabled. Both the server and my desktop run Ubuntu 14.04 and authentication ...
0
votes
1answer
2k views

Cannot run cron job for a php script

I want to run a php script using cron job on localhost my script is situated at - /opt/lampp/htdocs/rrugd/myscript.php now as opt is under root, i tried adding the cron job for root as well as ...