For some reason, I cannot get a simple cron job working on my Mint 18 KDE system.

This is the job, it tells a script to run every minute. See the crontab line that I get when I type crontab -l:

# m h  dom mon dow   command
1   *   *  *   *     sh /home/martien/crontest.sh

This is the script crontest.sh:

#! /bin/bash
cd /home/martien/archives/
DIRECTORY='webcam-'`date +%y-%m-%d-%H-%s`
mkdir ~/archives/$DIRECTORY

These are the properties of the script

-rwxrwxr-x 1 martien martien  110 Apr  2 07:35 crontest.sh

The file in /var/spool/cron/crontabs/ confirms the existence of the cron job.

Cron runs:

root       953     1  0 06:50 ?        00:00:00 /usr/sbin/cron -f

The script runs when I enter this in the command line:

sh /home/martien/crontest.sh

I run Mint 18 (Ubuntu Xenial).


1 Answer 1


Your cron entry runs once an hour, at one minute past:

 1 * * * * sh /home/martien/crontest.sh

If you want every minute you should use this:

 * * * * * /home/martien/crontest.sh 

Since you've declared your script to be a bash script and you've set it to be executable, just call it directly. Don't write a bash script and use sh to execute it as on some systems they really are different shells.

Your script can be amended slightly, too:

cd /home/martien/archives
DIRECTORY="webcam-$(date +'%y-%m-%d-%H-%s')"
mkdir "$DIRECTORY"

I've quoted your variables when they are used, and switched backticks to the more modern and consistent $(...) construct.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .