LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-17-2005, 05:06 AM   #1
DriveMeCrazy
Member
 
Registered: Mar 2004
Posts: 70

Rep: Reputation: 15
Script having problem with Crontab


Hi guys,

Got this problem here....
I have this piece of application installed on my *nix machine.
And the application actually has its own command to check its status.
The command are already in ENV variable.

So, I wrote a script sometime ago that incorporate the application command and put it into the crontab.
This script is supposed to be executed hourly and will send out email.

However, I notice some problem with the script.
Whenever I executed it manually, my script executed and display the app's status with no prob.
But when scheduled with cron, the display for the app's status alway goes missing.

Sample of the code:

echo "Application's Status" >> /tmp/out
appCheck >> /tmp/output #appCheck is the app's command

echo "Disk Usage" >> /tmp/out
df -k >> /tmp/output


Anybody got any idea what went wrong?!

Thanks in advance
 
Old 07-17-2005, 05:42 AM   #2
nIMBVS
LQ Newbie
 
Registered: Sep 2003
Location: Romania
Distribution: Linux Mint
Posts: 29

Rep: Reputation: 21
The PATH env variable of cron is very short. It contains only this: /usr/bin:/bin .

So always use the absolute path to the program that you use in your scripts.
 
Old 07-17-2005, 05:45 AM   #3
DriveMeCrazy
Member
 
Registered: Mar 2004
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by nIMBVS
The PATH env variable of cron is very short. It contains only this: /usr/bin:/bin .

So always use the absolute path to the program that you use in your scripts.
Ha.... thanks for enlightening me... I got what u mean
 
Old 07-17-2005, 04:19 PM   #4
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
For security, you should always use fully-qualified pathnames to the executables you use (eg, "/bin/grep", not just "grep") , to avoid people spoofing them by putting replacements earlier in your path.
 
Old 07-18-2005, 09:01 AM   #5
DriveMeCrazy
Member
 
Registered: Mar 2004
Posts: 70

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by eddiebaby1023
For security, you should always use fully-qualified pathnames to the executables you use (eg, "/bin/grep", not just "grep") , to avoid people spoofing them by putting replacements earlier in your path.
thanks for the advice

Btw, I have encountered another problem.

I am able to execute some of the application native commands.
But notice that some of them actually need the additional modules (from the application /lib path) in order to execute the command properly.

How can i actually reflect in my script so that the application native commands know
where to find the needed module without problem while executed via crontab?


Below is actually some examples of the error i captured:
exec(): 0509-036 Cannot load program /myApp/bin/app_listing
because of the following errors: 0509-150 Dependent module libqcnt.so could not be loaded.

0509-022 Cannot load module libqcnt.so. 0509-026 System error:
A file or directory in the path name does not exist.
 
Old 07-18-2005, 03:29 PM   #6
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Can you set a LIBPATH (or whatever it's called these day - LD_LIBPATH?) in the beginning of your script? Check your environment and see if the path to the libraries is setup somewhere, and replicate it in the script.
 
  


Reply



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
Using crontab in a bash script nro Linux - Newbie 3 08-26-2005 08:04 PM
error running script on crontab haora Linux - Newbie 3 03-11-2005 04:02 PM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM
crontab not finding script michaeln *BSD 4 08-22-2004 10:07 PM
Shell script running via crontab problem. thetruethugg Linux - Software 13 12-19-2003 08:56 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:11 PM.

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