Sponsored Content
Top Forums UNIX for Dummies Questions & Answers A command in a script not running in Crontab. Post 302330652 by mystition on Thursday 2nd of July 2009 03:59:42 AM
Old 07-02-2009
Bug

Thanks for the prompt reply... here is the part of the script(in bold) where the error is occuring.

In crontab entry i have simply given entry like this:
00 2 * * * /path/script_name

Code:
#!/bin/ksh
if cd /usr/Prepaid/Health-check 2>/dev/null;
then
 find /usr/Prepaid/Health-check -name "health_*" -mtime +30 -exec rm "{}" ";" 
else
cd /usr/Prepaid
mkdir Health-check
fi
logd=`date '+%Y%m%d-%H:%M'`
echo "\nAutomated health Check of HP IVR" > /usr/Prepaid/Health-check/health_$logd.log

-----------------------------------------------------------------------------------------------------
echo "\n\n---------------" >> /usr/Prepaid/Health-check/health_$logd.log
echo "SVI Call" >> /usr/Prepaid/Health-check/health_$logd.log
echo "--------------------------------------------------------------------------------" >> /usr/Prepaid/Health-check/health_$logd.log
date=`TZ=aaa00 date +%Y%m%d`
#cd /usr/mg2/svi/svicom >/dev/null 2>&1
/usr/mg2/svi/svicom/svistatjo.x -j $date -f /usr/Prepaid/log_$date.log >/dev/null 2>&1
cd /usr/Prepaid
echo "Type    Inter   Access  Appli   Called  Calling Diag    CnxT    CnxD    Node" >tempmmtstatjo
tail -5 log_$date.log >> tempmmtstatjo 
st=`wc -l tempmmtstatjo | awk '{print $1}'`
if [ $st -gt 2 ]
then
echo "The following is list of upto last five calls: " >> /usr/Prepaid/Health-check/health_$logd.log
cat tempmmtstatjo >> /usr/Prepaid/Health-check/health_$logd.log
tail -1 tempmmtstatjo > tempmmtstatjo1
awk '{print $8}' tempmmtstatjo1 > tempmmtstatjo2
hourc=`awk -F"H" '{print $1}' tempmmtstatjo2`
minc=`awk -F"H" '{print $2}' tempmmtstatjo2`
let timec=$hourc*60+$minc
hourn=`date '+%H'`
minn=`date '+%M'`
let timen=$hourn*60+$minn
let gapt=$timen-$timec
let gaph=`expr $gapt / 60`
let gapm=`expr $gapt % 60`
 if [ $gapt -gt 10 ] && [ $gapt -le 30 ]
 then
 echo "\nMajor Warning: There were no call records in the last $gapt minutes" >> /usr/Prepaid/Health-check/health_$logd.log
 elif [ $gapm -gt 30 ] || [ $gaph -gt 0 ] || [ $gapt -gt 30 ]
 then
 echo "\nCritical Warning: There were no call records in the last $gaph hours $gapm minutes" >> /usr/Prepaid/Health-check/health_$logd.log
 else
 echo "\nThe last call record is of $gapm minutes ago" >> /usr/Prepaid/Health-check/health_$logd.log
 fi
else
echo "Critical Warning:There were no call records found on the server for today. Please check." >> /usr/Prepaid/Health-check/health_$logd.log
fi
rm tempmmtstatjo
rm tempmmtstatjo1
rm tempmmtstatjo2
rm log_$date.log

#---------------------------------------------------------------------------------------
cat /usr/Prepaid/Health-check/health_$logd.log > /usr/Prepaid/Health-check/health-check.log
#---------------------------------------------------------------------------------------



---------- Post updated at 01:29 PM ---------- Previous update was at 11:38 AM ----------

Issue Solved!

Added this line in the script after defining the shell path:

. ${HOME}/.profile


//

Last edited by mystition; 07-02-2009 at 05:49 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

issue with running script with crontab

I am facing a strange issue while running a script(eg A) from the crontab entry the script calls one more script(eg B) within it now when i run the script A manually(with nohup) it also executes the script B (embedded inside it) as expected. but when i run the script A from the crontab entry... (7 Replies)
Discussion started by: mad_man12
7 Replies

2. UNIX for Dummies Questions & Answers

Getting error when running script through crontab

Hi all, I wrote small script for Solaris and when I am running it through command prompt its ok, but when I trying to run it using crontab, i am getting error like: ld.so.1: dbloader: fatal: libACE.so: open failed: No such file or directory /tmp/file.sh: line 5: 8304 Killed ... (4 Replies)
Discussion started by: nypreH
4 Replies

3. Shell Programming and Scripting

Problem with crontab running a script

I am trying to use the CRON utility in Fedora 11 & CentOS... I intend to run a script which pops up a warning message every hour and i made the following entry using "CRONTAB -e " * * * * * sh /bin/myscript.sh But this does not seem to be running. Another thing to note is that,... (4 Replies)
Discussion started by: Vabiosis
4 Replies

4. Shell Programming and Scripting

Running SQLPLUS Script in CRONTAB

Hi, Can someone please help me here with this one. This is my script: # more tosh.sh #!/usr/bin/ksh clear . /home/oracle/.profile echo "Good morning, world." export ORACLE_HOME=/u01/app/oracle/product/9.0.1 export PATH=$ORACLE_HOME/bin:/usr/local/bin export ORACLE_SID=xxxx ... (11 Replies)
Discussion started by: santoshpayal
11 Replies

5. Shell Programming and Scripting

Crontab not running a script

Hi, I posted this in the Solaris forum but I think this one would be more appropriate. I created a script starting with the following lines: #!/usr/bin/ksh flag=n export flag typeset -i quant=0 (...) When running it I'm getting the following 2 errors: /tmp/tstscript/testfail.ksh:... (9 Replies)
Discussion started by: Cvg
9 Replies

6. UNIX for Advanced & Expert Users

Particular script not running through crontab

Hi, I have created the below script, set -x # Set the Path of Environment file ENV_FILE_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/bin LOG_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/log export ENV_FILE_DIR export LOG_DIR # Set Audit Environment . ${ENV_FILE_DIR}/QDM.env... (8 Replies)
Discussion started by: yohasini
8 Replies

7. UNIX for Dummies Questions & Answers

crontab not running script

Hi All, I am having the below script to be run from crontab, it it doesnt run. 1 * * * * /home/cobr_ext/test.sh > /home/cobr_ext/temp.txt when i run i manally it runs without any issues. Could please help me as to why doesnt it run the script.:( (7 Replies)
Discussion started by: abhi_123
7 Replies

8. Shell Programming and Scripting

Delay in running script from crontab

I am facing an issue where sometimes crontab is running script with some delay. Below is the stmt in script and it is the only stmt in script. echo "running at `date` " >> CRONCHECK.log Below is the cron entry. 0 11 * * * CRONCHECK.sh Below is the time of run each day. running at Fri... (8 Replies)
Discussion started by: Nishant Singh
8 Replies

9. Solaris

Script problem when running on crontab

Hi guys! I created a backup script that works fine when I run manually, but when I put a crontab job to execute it the result are not the expected. (not a time problem). Here is my script: bash-3.00# cat /bk_tool/backup2.sh #!/usr/bin/csh clear set DIR_HOST='SCP08' ... (3 Replies)
Discussion started by: andredemartini
3 Replies

10. UNIX for Dummies Questions & Answers

CRONTAB - one python script is not running

Hi! I'm using a RaspberryPi with standard Raspbian. Currently I'm working on some sort of weather station. For now I have three python scripts - one which is updating txt files for website - update1m.py ( it will not be necessary in few next days so I'll delete it) , second one for updating... (4 Replies)
Discussion started by: bartocham
4 Replies
binlog.conf(4)						     Kernel Interfaces Manual						    binlog.conf(4)

NAME
binlog.conf - binlogd configuration file SYNOPSIS
event_code.priority destination Where: Are the numeric codes specified in binlog.h and the binlogd(8) reference page. An aster- isk (*) specifies that all events should be selected. The code dumpfile Specifies the recovery of the kernel binary event log buffer from a crash dump. A severity level cannot be specified. Filters selected events as severe, high, and low. An asterisk (*) specifies that all events should be selected. A local file pathname to a log file, or a remote system hostname for remote logging of events. DESCRIPTION
The /etc/binlog.conf file is a system file that enables you to configure or filter events that are to be logged by the binary error logger, binlogd. The binlogd daemon ignores blank lines and lines that begin with an octothorpe (#). You can specify # as the first character in a line to include comments in the file or to disable an entry. If you want the binlogd daemon to use a configuration file other than the default, specify the file name with the following command: # bin- logd -f config_file Note that EVM subscribes to binlog events by default, and any configuration options you select will affect what events are available to EVM. You can filter and select binlog events using EVM utilities, as described in the EVM(5) reference page. EXAMPLES
The following is a sample /etc/binlog.conf file: # # binlogd configuration file # #format of a line: event_code.priority destination # # where: event_code - see codes in binlog.h and man page, # * = all events # priority - severe, high, low, * = all priorities # destination - local file pathname or remote system # hostname *.* /usr/adm/binary.errlog dumpfile /usr/adm/crash/binlogdumpfile crdlog /usr/adm/binary.crdlog 102.high /usr/adm/disk.errlog FILES
/etc/binlog.conf /etc/binlog.auth - Authorization file for remote logging. /usr/sys/include/dec/binlog/binlog.h - Common components of a binary event log record. RELATED INFORMATION
Commands: /usr/sbin/binlogd(8), EVM(5) System Administration delim off binlog.conf(4)
All times are GMT -4. The time now is 09:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy