Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I store some of my configuration files in version control. Recently I tried to setup a daily anacron job so that I won't have to manually update the files. I have never used cron or anacron before but reading through cron documentation I decided to put my script in /etc/cron.daily. Below is my script named dot-files (changed to executable with chmod +x):


cd /home/dell/dot-files && /usr/bin/git add . && /usr/bin/git commit -a -m 'daily update' && /usr/bin/git push -u origin master

However it doesn't seem to be running for the last two days. Here are the lines from /var/log/syslog:

Aug 21 10:42:02 dell-Studio-1535 anacron[1023]: Job `cron.daily' terminated (exit status: 1) (mailing output)
Aug 21 10:42:02 dell-Studio-1535 anacron[1023]: Can't find sendmail at /usr/sbin/sendmail, not mailing output

Can anyone see what's wrong with that? Also am I using a wrong setup for the purpose?

p.s. I'm using an ubuntu 12.04 system and it's not always running.

share|improve this question
up vote 1 down vote accepted

OK, first things first. You don't see what went wrong because cron could not mail you the output. Instead, however, of configuring your sendmail, modify your script such that it stores the output of your commands:


export workdir=/home/dell
export logfile=$workdir/dot-files.log
export errfile=$workdir/dot-files.err
date >> $logfile
date >> $errfile

{ cd $workdir/dot-files && /usr/bin/git add . && /usr/bin/git commit -a -m 'daily update' && /usr/bin/git push -u origin master ; } >> $logfile 2>> $errfile

Furthermore, you do not need to put it into the cron directly as root, you can run crontab as user.

man crontab

P.S. What happens when you run that script manually?

share|improve this answer
turned out my scripts were not running manually either. thank you for the suggestion. I have tried to setup an ssh connection for git so that I won't have to deal with username and password in the script, I guess something went wrong. I'll try to fix it. – gokcehan Aug 21 '12 at 9:58
script is fixed now. so about that crontab, I was trying to use anacron in the first place because my computer is not always on. is it possible to set crontab to work once a day independent of the hours it is on/off? – gokcehan Aug 21 '12 at 10:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.