LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-23-2012, 03:45 PM   #1
Mr. K
LQ Newbie
 
Registered: Dec 2012
Location: Sweden
Distribution: Debian / Ubuntu
Posts: 1

Rep: Reputation: Disabled
Help with cron job


Howdy !

I'm niether expert or newbi but cant get this crontab to work.
What i whant is to check if a python script has hung, if so kill the process and restart it. Allso delete tmp file lagger than say 10k.

Running the script manually works fine but if i place it in cron.hourly i get this error:

Dec 23 17:17:01 raspberrypi /USR/SBIN/CRON[1781]: (CRON) error (grandchild #1782 failed with exit status 1)
Dec 23 17:17:01 raspberrypi /USR/SBIN/CRON[1781]: (CRON) info (No MTA installed, discarding output)

and the script is:

#!/bin/bash
/usr/bin/find /home/pi/weather/data/weather.ini -mmin +10 | grep /home/pi/weath$
rc=$?
if [ "${rc}" -ne "1" ] ; then
sudo pkill python
sudo nohup python /home/pi/weather/pywws-12.10_r547/LiveLog.py /home/pi/weather$
fi
sudo find /tmp/weather -name weather.txt -size +10k -exec rm -f {} \;

Any ideas ?
 
Old 12-23-2012, 09:07 PM   #2
Bev
LQ Newbie
 
Registered: Sep 2008
Location: Ontario, Canada
Distribution: Slackware 14.2 64bit
Posts: 9

Rep: Reputation: 17
Your problem is most likely a PATH problem. The script ran OK from a shell so the script itself is OK. You normally need to specify the complete path to executables when running scripts from cron.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian daily cron job won't run, but does run in cron.hourly. sandersch Linux - General 7 05-24-2012 02:50 AM
how to abort cron if the previous cron job not yet finished? Winanjaya Linux - Newbie 2 05-22-2012 07:44 PM
linux cron job duplicate job question cpthk Linux - Newbie 4 09-11-2009 09:52 PM
Cron Job esuradi Fedora 2 07-22-2009 11:22 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration