LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-23-2004, 07:09 PM   #1
lifetaster
LQ Newbie
 
Registered: Feb 2004
Location: Singapore
Distribution: HP-UX
Posts: 29

Rep: Reputation: 15
cron problem with script


I wrote a script with logCat to retrieve log files. It functioned well after testing.
But, when I scheduled it with crontab, it executed at the time specified in the crontab files, but the problem is: the file generated by this script after auto executing was zero in size. when i tried it again by executing it, some contents were then generated.

Last edited by lifetaster; 02-23-2004 at 07:10 PM.
 
Old 02-23-2004, 08:23 PM   #2
retep
Member
 
Registered: Sep 2003
Distribution: RedHat/Debian
Posts: 50

Rep: Reputation: 15
Most likely a bug in your script.

Try 'cd'ing' to a random directory. e.g. /usr and running the script using an absolute path. Sometimes I've seen scripts not work properly because they are run from different directories.

(And if you reproduce the problem this way, just specificy absolute paths in your script).
 
Old 02-23-2004, 08:49 PM   #3
lifetaster
LQ Newbie
 
Registered: Feb 2004
Location: Singapore
Distribution: HP-UX
Posts: 29

Original Poster
Rep: Reputation: 15
I did use the abs path,

#!/usr/bin/ksh
#testsize.sh
logCat -d /sms/smslog/alarm -l alm -a"02/23/2004" -z"02/24/2004" >/tmp/alm/Feb/test.log

the script above is used to retieve log files generated by telecom servers and format them.
$sh testsize.sh
or
$/usr/bin/ksh testsize.sh
or
$chmod 777 testsize.sh
$./testsize.sh
the above three method were all able to generate a non-zero test.log file.

while when scheduling with file named crontest shown below:
15 10 * * * /usr/bin/ksh /shome/sms/.../testsize.sh
the file test.log was also generated, but with zero size, viz nothing written in.

Thank you for your advice.
 
Old 02-24-2004, 12:26 AM   #4
lifetaster
LQ Newbie
 
Registered: Feb 2004
Location: Singapore
Distribution: HP-UX
Posts: 29

Original Poster
Rep: Reputation: 15
Solved!
I didn't specify the full path of logCat.
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
Problem With Script in cron.daily fizbang Linux - Newbie 10 03-21-2005 10:23 AM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 02:54 PM
Cron script help mpls mikeg Linux - Software 2 09-24-2004 09:28 AM
Help with Script and Cron goldstonrumpke Linux - Newbie 10 05-30-2004 11:51 PM

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

All times are GMT -5. The time now is 08:41 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
Open Source Consulting | Domain Registration