Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] crontab not executing
Date: Mon, 20 Jun 2011 15:04:35
Message-Id: BANLkTimXvVvv0-PU7n68TA85pY5AdpXWfg@mail.gmail.com
1 >> One of my systems has a crontab like this to clean up and
2 >> consolidate the output of the video monitoring app "motion":
3 >>
4 >> # crontab -l
5 >> # DO NOT EDIT THIS FILE - edit the master and reinstall.
6 >> # (/home/grant/cron.root.txt installed on Sat Sep 25 10:42:18 2010)
7 >> # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42
8 >> vixie Exp $) 50 23 * * * /bin/rm /home/motion/$(date -d 'yesterday'
9 >> +%Y%m%d)*.jpg 55 23 * * * /bin/rm /home/motion/$(date -d
10 >> 'yesterday' +%Y%m%d)*.avi 59 23 * * * /usr/bin/mencoder
11 >> /home/motion/$(date +%Y%m%d)*.avi -noidx -o
12 >> /home/motion/full-$(date +%Y%m%d).avi -ovc copy -oac copy
13 >>
14 >> If I execute each command manually, it works great, but nothing
15 >> happens otherwise.  Can someone tell me why this crontab doesn't
16 >> seem to be executing?
17 >
18 > crontab does not use the same shell you use, so when your crons run
19 > they are missing all of the niceties you are used to using yourself.
20 >
21 > Things like PATH for example, and the $() may or may not work.
22 >
23 > You have paths for rm and mencoder but not for date
24
25 I've switched to this but I can't find the date binary. Does anyone
26 know the full path for date?
27
28 50 23 * * * /bin/rm /home/motion/`date -d 'yesterday' +\%Y\%m\%d`*.jpg
29 55 23 * * * /bin/rm /home/motion/`date -d 'yesterday' +\%Y\%m\%d`*.avi
30 59 23 * * * /usr/bin/mencoder /home/motion/`date +\%Y\%m\%d`*.avi
31 -noidx -o /home/motion/full-`date +\%Y\%m\%d`.avi -ovc copy -oac copy
32
33 - Grant

Replies

Subject Author
Re: [gentoo-user] crontab not executing Peter Humphrey <peter@××××××××××××××.org>