Cron does not run the script

Status
Not open for further replies.

Heuveltje

Verified User
Joined
Nov 7, 2006
Messages
73
Location
Leek, NL
Hi all,

i created a script to generate a little movie from jpg's to mpg, once a day at 01:00 am.

When run in ssh as root there are no problems at all.
If cron executes this script nothing happens, it shows up in the cron log, however no file is created.

When i do user > cron and enter info nothing happens i even tried creating a file in /etc/cron.d called camera
Code:
0 1 * * * root /home/username/domains/userdomain.nl/public_html/camera.cron

camera.cron:
Code:
/usr/local/lib/convert -delay 10 -quality 75 /home/username/domains/userdomain.nl/public_html/webcam/`date --date="yesterday" +%Y_%m_%d`*.jpg /home/username/domains/userdomain.nl/public_html/webcam/movie/dag/`date --date="yesterday" +%Y_%m_%d`.mpg

Best would be to get the "user" cron (in controlpanel) to work. Any thoughts?
 
Last edited:
My output in some email is as follows:

Return-path: Envelope-to: [email protected] Delivery-date: Thu, 13 Sep 2007 16:00:01 +0200 Received: from root by hostdomain.nl with local (Exim 4.67) (envelope-from ) id 1IVpEf-0005dO-5h for [email protected]; Thu, 13 Sep 2007 16:00:01 +0200 From: [email protected] (Cron Daemon) To: [email protected] Subject: Cron /home/username/domains/userdomain.nl/public_html/camera.cron X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: Message-Id: Date: Thu, 13 Sep 2007 16:00:01 +0200 /home/username/domains/userdomain.nl/public_html/camera.cron: line 4: : command not found /home/username/domains/userdomain.nl/public_html/camera.cron: line 7: /usr/local/lib/convert: No such file or directory /home/username/domains/userdomain.nl/public_html/camera.cron: line 8: : command not found
 
do this.

which date

then replace the cron date with the full path.

After you have edit, do this.
service crond restart
 
which date > command not found

is it a command? should i edit the cronjob somewhere.
Sorry i dont quite get it..
 
which is a command that will locate where is date located in.

yum install -y which

and try again the command as above.

Always use full path to the command you want to run in cronjob.
 
Wow, that worked... However.

Now i get the following error
Code:
Sender: CronDaemon Date: Fri, 14 Sep 2007 16:50:14 +0200 sh: mpeg2encode: command not found convert: Delegate failed `"mpeg2encode" "%i" "%o"'.

while the cron code is like this:
Code:
/usr/local/bin/convert -delay 5 -quality 75 /home/username/domains/userdomain.nl/public_html/webcam/`/bin/date --date="1 hours ago" +%Y_%m_%d_%H`*.jpg /home/username/domains/userdomain.nl/public_html/webcam/movie/uur/`/bin/date --date="1 hours ago" +%Y_%m_%d_%H`.mpg

Thanx for your info and input
 
When i run it as root i get a nice file generated.

The cron creates a file, 0 bytes. Including the notification as above via mail.

Can this be some permissions problem? Convert/imagemagick has it's reverences for root correct but not for username? (just a thought)
 
My problem has been solved!

I had to make a copy of the mpeg2encode to another dir than specified:

Code:
cd /user/local/bin/mpeg/mpeg2/src/mpeg2enc
cp mpeg2encoder /usr/bin

i had a copy placed in /usr/local/bin, which was not good.

tanfwc, thanx for your input!
 
Status
Not open for further replies.
Back
Top