Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script will run from command line but not cron 2

Status
Not open for further replies.

siswjh

MIS
Dec 6, 2001
63
US
I have a script that zips files. When i run it from the command line it works fine. When I put it in the cron it dosen't work. This is the error from cron that is sent to the root mailbox.

Your "cron" job on detroit
/export/home/siswjh/korn/zipthis

produced the following output:

zip warning: name not matched: dskusage

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: freespace

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: ftpD

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: ftpacbs

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: logins_nopass

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: message

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: moveas400

zip error: Nothing to do! (korn.zip)
zip warning: name not matched: performance

zip error: Nothing to do! (korn.zip)

This is the script.

#!/bin/ksh
HOME="/export/home/siswjh/korn"
AHOME="/export/home/siswjh/ftp"
filesndir=$(ls -l $HOME|nawk '{print $9}'|grep -v "ftppmag"|grep -v "zipthis")
for lines in $filesndir
do
zip korn $lines
done
Does anyone have any clues.
Thanks
Jesse
 
When you run from the command line you have the environment in your .profile or .cshrc, when you run in cron you need to call your environment explictly

in the .sh I set my values
#!/bin/ksh
. /usr/local/bin/BIG2set
MIPPY_PATH=/applmgr/mippy
/oracle/product/734/bin/sqlplus mippy/mippy @MIPPY_PATH/mthendval.sql


/usr/local/bin/BIG2set is the file that sets my environment I tried to remain child-like, all I acheived was childish.
 
Add /export/home/siswjh/korn to your set path in the ROOT .cshrc/.profile which ever you are using. Where you run the script you are logged in a the user with that path in the .cshrc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top