If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Script in cronjob fails

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-30-09, 10:45
himango himango is offline
Registered User
 
Join Date: Mar 2009
Posts: 1
Script in cronjob fails

Hi ,

I have a cronjob which is running perfectly fine from the past one year.

Two days back one of the scripts present in cronjob failed to start, which forced me to run it manually.

Now that script is not running at al, i have to run it manually.

The crontab entries are below.

Can anyone please help?

The script marked in bold and italic failed to run.


15 0 * * * /export/home/ceridwen/bin/run_cdr2daily.sh




#!/bin/sh
2
3 PATH=/cw/bin:/cw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/local/bin:/opt/local/bin
4 export PATH
5
6 ###############################
7 #Changing SME name
8 #/export/home/ceridwen/bin/fix2hicdrs.pl | mailx -s "output of fix2hicdrs.pl" example@example.com
9 #/export/home/ceridwen/bin/sumAccounting5m.pl | mailx -s "output of Sum Accounting 5m.pl" example@example.com
10
11 ###### New #################
12 /export/home/ceridwen/bin/fix2hicdrs.pl | mailx -s "output of fix2hicdrs.pl"
13 /export/home/ceridwen/bin/sumAccounting5m.pl | mailx -s "output of Sum Accounting 5m.pl"
14 ###############################
15
16 /export/home/ceridwen/bin/yesterdays_cdr2daily.pl -M SNMP
17 /export/home/ceridwen/bin/yesterdays_cdr2daily.pl -M BULK
18 /export/home/ceridwen/bin/yesterdays_cdr2daily.pl -M JBULK
19 /export/home/ceridwen/bin/yesterdays_cdr2daily.pl -M SUM5M

20 ## /export/home/ceridwen/bin/yesterdays_cdr2daily.pl -M JIPACC
21 /export/home/ceridwen/bin/yesterdays_cdr2daily.pl -M IPACC
22
23 echo "update flags set flagvalue=1 where flagname='ready_for_mail_daily';" | mysql -ucdr cdr
24 echo "update flags set flagvalue=1 where flagname='ready_for_gbag';" | mysql -ucdr cdr
25 echo "update flags set flagvalue=`date +%s` where flagname='ready_for_mail_monthly';" | mysql -ucdr cdr
26 echo "update flags set flagvalue=`date +%s` where flagname='ready_for_mail_billing';" | mysql -ucdr cdr
27 echo "update flags set flagvalue=`date +%s` where flagname='ready_for_push_monthly';" | mysql -ucdr cdr
28 echo "update flags set flagvalue=`date +%s` where flagname='ready_for_push_billing';" | mysql -ucdr cdr
29
30 /export/home/ceridwen/bin/cdraggregate.pl
31

Last edited by gvee; 03-31-09 at 09:50. Reason: email addresses replaced with example@example.com
Reply With Quote
  #2 (permalink)  
Old 03-30-09, 11:29
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,413
Cool set -x

Without you providing error messages or anything else, it is dificult to "guess" what the issue is.

Maybe something must have changed?.

Add set -x and a log file to your script and cron:

Code:
## In crontab:
15 0 * * * /export/home/ceridwen/bin/run_cdr2daily.sh >/tmp/run_cdr2daily.log 2>&1
##
## In your script:
#!/bin/sh
PATH=/cw/bin:/cw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/local/bin:/opt/local/bin
export PATH
set -x
## Etc ...
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 03-31-09, 09:19
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,517
It might also be worth editing your code to remove the email addresses. This will stop these user from getting spammed.
Reply With Quote
  #4 (permalink)  
Old 03-31-09, 09:45
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,233
That's nothing compared to the guy posting user IDs and passwords to Credit Suisse servers the other day. I suspect outsourcing may not be as cost effective as it appears on the surface...
Reply With Quote
  #5 (permalink)  
Old 03-31-09, 09:51
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,002
Email addresses removed
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On