The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Unable to sftp with cron (once more time...) Kronos UNIX for Dummies Questions & Answers 7 05-06-2009 10:21 AM
unable to schedule events through cron rakshit HP-UX 7 01-31-2008 04:57 AM
schedule many jobs using cron sireesha15 UNIX for Dummies Questions & Answers 1 11-28-2006 11:20 PM
How to Schedule job using cron(URGENT) ravi.sadani19 Shell Programming and Scripting 2 01-23-2006 07:10 AM
Cron to schedule 1st Wednesday of every Month?? bradtri Shell Programming and Scripting 5 10-20-2004 12:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-05-2009
ace@123 ace@123 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
unable to schedule in cron

the follwing script is running fine , when run from the ksh shell...it runs properly i.e. waits for a file "test.flag" and sends mail accordingly.


But when I schedule it in the crontab ...it does not run at the specified time (it never runs).
I am using ksh

####shell script starts
count=1
while true; do
if test -f test.flag
then
mailx -s "File Found" s.ba@dsc.com s.ba@hcil.in </man/prd2/bat/tmp/found.txt
exit 0
fi
let count="$count + 1"
#####count=$(( $count + 1 ))
sleep 2
####wait (2)
if [ $count -gt 300 ]
then
mailx -s "File not Found" s.ba@dsc.com s.ba@hcil.in </man/prd2/bat/tmp/not_found.txt
exit 0
fi
done

####shell script ends

###ran crontab -l
20 11 * * * /sa/p/brd/tmp/mailer.sh

##### ran uname -X
System = SunOS
Node = ritba
Release = 5.8
KernelID = Generic_108528-24
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 2


Please suggest, (the path of .txt files is correct)

Last edited by ace@123; 01-06-2009 at 01:13 AM.. Reason: added info
  #2 (permalink)  
Old 01-05-2009
ssachins ssachins is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 29
need information

As mentioned by you, 'it does not run at the specified time' means it runs after the apecified time or never runs ?
  #3 (permalink)  
Old 01-05-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,147
Check "man crontab" for the exact location of cron's files on your system.
Please state the unix/Linux version - there is much variation.

In general:
Check /usr/adm/cron/log to see if the job ran at all.
Run "fuser /usr/adm/cron/log" and check there is a process using the log (i.e. cron is running).
Check mail for the user of the cron for error messages.
Check /usr/adm/cron/cron.allow and /usr/adm/cron/cron.deny to make sure that the user is allowed to run a cron.
  #4 (permalink)  
Old 01-05-2009
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,402
Maybe mailx is not on the path for the cron user?
  #5 (permalink)  
Old 01-06-2009
ace@123 ace@123 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
Quote:
Originally Posted by Ygor View Post
Maybe mailx is not on the path for the cron user?
Path is correct ...
Sponsored Links
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 04:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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