The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
determine if the script has been invoked manually or not? hitmansilentass Shell Programming and Scripting 8 06-22-2008 12:32 PM
SFTP errorcode 1 when run on cron but runs manually Heidi.Ebbs SUN Solaris 2 08-08-2007 01:16 PM
how to implement patch manually sheilly_2k7 UNIX for Advanced & Expert Users 1 05-03-2007 06:57 PM
check in unix shell script so that no one is able to run the script manually adi_bang76 Shell Programming and Scripting 1 11-16-2006 10:43 AM
Works Manually - not in CRON dstinsman UNIX for Dummies Questions & Answers 5 03-06-2006 08:36 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-18-2005
MadHatter MadHatter is offline
Registered User
  
 

Join Date: Jun 2005
Location: New York City
Posts: 20
Can run script Manually, but not through Cron?

Hi all,

I have a main script (called OracleCleanup) that runs some sql queries. that runs off a wrapper script which contains the sources for the login information and and JOB_HOME (the script is below). When I schedule this job in the cron the log says that it cannot open my list file, which is located in somefolder. If i run this script manually by simply invoking it, it runs without any issues. Any ideas?

#!/bin/ksh

# Source appropriate login information
. $HOME/somefolder/login_Cleanup.ksh

# Set the JOB_HOME (ie. where the lists of tables to archive are held)
export JOB_HOME=/home/oracle/somefolder

# Run the job.
$HOME/somefolder/OracleCleanup.ksh

# Rename logfile
mv $HOME/somefolder/log/OracleCleanup.log $HOME/chris/log/OracleCleanup.`date +%m_%d_
%Y`.log
  #2 (permalink)  
Old 10-18-2005
mr-synapse mr-synapse is offline
Registered User
  
 

Join Date: Jul 2005
Location: Mt. Prospect, Illinois
Posts: 32
Script won't run via cron

Hello Madhatter,
I would suggest that you change the shell to the native shell for (most) systems, i.e. /bin/sh. The cron function may use this shell instead of the "K - shell" I would suggest starting there.
  #3 (permalink)  
Old 10-19-2005
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,631
On AIX (and HP-ux IIRC) the default shell is ksh, so that doesn't need to be the problem.

your cronjobs might be executed under a different user, so check the rights of ..../somedir to make sure it is accessible from within your cronjob.

bakunin
  #4 (permalink)  
Old 10-19-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
This has been addressed in a FAQ entry.

either change
. $HOME/somefolder/login_Cleanup.ksh
to
. /wherever/home/is/somefolder/login_Cleanup.ksh
(and do similar things for other $HOME occurrances)

or

export HOME=/wherever/home/is

before the first use of $HOME

Cheers
ZB
  #5 (permalink)  
Old 10-19-2005
MadHatter MadHatter is offline
Registered User
  
 

Join Date: Jun 2005
Location: New York City
Posts: 20
thanks for all the suggestions everyone! turns out that the list file wasn't fully qualified in the main script. it wasn't pathed at all, so that's why it only worked manually when i was in the current folder. I don't know how i didn't see that!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:05 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0