The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > HP-UX
Google UNIX.COM


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Telnet is not working properly deepak_pathania UNIX for Dummies Questions & Answers 1 10-05-2007 02:59 PM
Rlogin not working properly from Linux frankkahle UNIX for Advanced & Expert Users 1 10-19-2006 07:02 PM
Cron won't run properly Steeler_fan UNIX for Dummies Questions & Answers 2 08-31-2006 06:32 AM
y is this not working properly? C|[anti-trust] High Level Programming 3 05-18-2005 09:55 AM
Keyboard not working properly... timresh UNIX for Dummies Questions & Answers 2 02-25-2005 04:28 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #15  
Old 10-30-2007
Registered User
 

Join Date: Oct 2007
Posts: 61
Why to put $ ???
More over hope u remember the point "script works fine when executed manually" ....

My script is just as follows:

#!/usr/bin/sh

ZIPFILE_PATH=/...
MYLOCATION=/...

cd MYLOCATION

unzip $ZIPFILE

FILECOUNT=`ls -l | wc -l`

if [ $FILECOUNT -eq 7 ]
then
do some process
else
send an error mail


So for me, when i schedule the above script in CROn, always i do get the error mail. If i run it manually then "do some process" is happening.

what can be done ???
Reply With Quote
Forum Sponsor
  #16  
Old 10-30-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,328
Shouldn't the unzip command read:

unzip $ZIPFILE_PATH # here I am assuming that the ZIPFILE_PATH holds the entire path, including the filename.

I don't see you setting $ZIPFILE anywhere in the script.
Reply With Quote
  #17  
Old 10-30-2007
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
Quote:
Originally Posted by risshanth View Post
Why to put $ ???
More over hope u remember the point "script works fine when executed manually" ....

My script is just as follows:

#!/usr/bin/sh

ZIPFILE_PATH=/...
MYLOCATION=/...

cd MYLOCATION

unzip $ZIPFILE

FILECOUNT=`ls -l | wc -l`

if [ $FILECOUNT -eq 7 ]
then
do some process
else
send an error mail


So for me, when i schedule the above script in CROn, always i do get the error mail. If i run it manually then "do some process" is happening.

what can be done ???
As previously said , you just need to load your login profile (.profile, .login or whatever it is) for the cron to mimic the environment you are in when you're on the shell, try that and everything should be ok.
Reply With Quote
  #18  
Old 10-30-2007
Registered User
 

Join Date: Oct 2007
Posts: 61
hi blowtorch,

its was a samll mistake while typing here...

its not $ZIPFILE ..
it should be

unzip $ZIPFILE_PATH
Reply With Quote
  #19  
Old 10-30-2007
Registered User
 

Join Date: Oct 2007
Posts: 61
hi andryk,
loading my .profile means ... i dont get you .. just executing that file or not clear .. but one thing . simple jobs scheduled in cron is working fine ..

I want to add one more point here ..

when i gave :
$whereis unzip , its showing

unzip :

So i think its not able to find the location of the unzip command.. Could this be the reason why cron is not able to execute the unzip command ??
Reply With Quote
  #20  
Old 10-30-2007
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
Quote:
Originally Posted by risshanth View Post
hi andryk,
loading my .profile means ... i dont get you .. just executing that file or not clear .. but one thing . simple jobs scheduled in cron is working fine ..
Yes, the way of loading your profile in your batch is '. $HOME/.profile', there's a space between the dot and the $ (without the quote of course )

Quote:
I want to add one more point here ..

when i gave :
$whereis unzip , its showing

unzip :

So i think its not able to find the location of the unzip command.. Could this be the reason why cron is not able to execute the unzip command ??
Maybe, you may want to search for it: find /usr -name unzip -print or even from the root.

Good luck.
Reply With Quote
  #21  
Old 10-30-2007
Registered User
 

Join Date: Oct 2007
Posts: 61
Hi andryk,
Great .. thanks a lot .. its working ... But i want to know the reason behind this ... what is the necessity to run the .profile file ?? Kindly give me an explanation ..

Thank u so much once again ..
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0