I am very new to this forum and new to Shell Script as well , hope some script Guru's will help me .
I have a requirment to write a shell script . The requirment is like this . There are couple of shell scripts scheduled in the Crontab (some scripts run multiple times a day) and i need to write a new shell scripts fo find out whether the scheduled cron scripts ran Successfully or not and send a status report by mail if some sheduled script fails ??
i dont have a clue how to approch this, can some one help me on this ??
Thanks
Dilip
---------- Post updated at 07:16 PM ---------- Previous update was at 07:06 PM ----------
Quote:
Originally Posted by dilipd21
Hi ,
Good Morning every one !!!
I am very new to this forum and new to Shell Script as well , hope some script Guru's will help me .
I have a requirment to write a shell script . The requirment is like this . There are couple of shell scripts scheduled in the Crontab (some scripts run multiple times a day) and i need to write a new shell scripts fo find out whether the scheduled cron scripts ran Successfully or not and send a status report by mail if some sheduled script fails ??
i dont have a clue how to approch this, can some one help me on this ??
Did you know there is something called STDERR 2> /dir/files to get results to files.
also you can use symbols like & and | operator to get email incase of failure.
Do you want complete script to be written ? When you say failure what does that mean ?
Also have considered looking at autosys ? It does exactly what you want and much more.
thanks for the mail sir , actually the requirment is very simple . if the scheduled job in cron did not run for some reason we need to this new script to send us a notification that the particular script did not run .
Are you checking if the script has issue or cron has issue.
For Script: You need to add to script to email you incase of failure. Share more details of script and there could be a better error handling be suggested.
For Cron: You can add at start of cron
Check more details in
Incase your server is down which has crontab . Then no email will not send.
Depending on setup I would suggest to use autosys or Control-M
whether the scheduled cron scripts ran Successfully or not
could be 2 things:
- schedule and execution by cron is correct but script generated errors -> thats not cron concern but the responsability of the script
- cron could not execute and you would find that in cron logs or your mbox...
Thanks for the replies . This is my case , i have the below scripts scheduled on cronjob already
Note : the above scheduled script output has not been redirected to any file it wll only send mail if it fails thats it
Now i need to write a new script called check_cronjab.sh and i will schedule that in cronjob , say this new check_cronjab.sh is schedules to run every 30 minutes .
The requirment is like this the check_cronjab.sh which run every 30 minutes has to find if the above scripts like logdelete.sh,dumpdelete.sh,clean_response_cache.sh etc has ran or not if it did not run for some reason then this check_cronjab.sh has to send me a mail that the particular script which has been scheulded to run on so and so time did not run for so and so reason ..
I am not sure if this can be done or not ??
Thanks
Last edited by Franklin52; 09-12-2013 at 04:04 AM..
Reason: Please use code tags
Hello Experts
My SAP application is running in IBM AIX. Everyday my application generate some files in the below path as below.
root@sedcaspm0502: pwd
/interfaces/RFTS/B11/archive
root@sedcaspm0502: ls -lrt
-rw-r r 1 ppgadm sapsys 1039445 May 08 01:20... (1 Reply)
Hi All,
I am connecting from ServerA(Unix) to ServerB (AIX). Copying a Database dump file from A to B. On B i need to import that dump file.
I have used the following code to do this operation but ended up with error
Pseudo-terminal will not be allocated because stdin is not a terminal.... (2 Replies)
Hi.
I created schell script for sending messages to some processes in AIX:
#!/bin/sh
BSE=/infor/ERPLN/bse
BSE_TMP=/infor/ERPLN/bse/tmp
export BSE BSE_TMP
for i in `ps -eo pid,comm | grep bshell | cut -f 1 -d " "`
do
/something $i
done
Unfortunatelly this script does not work on... (6 Replies)
Hi,
When I run the following script from a shell it works fine as root. But when I try to run from cron as root it fails everytime? I set the scripts I run in cron to send me the output if they fail but this produces nothing. Please see script below, maybe someone can see whats wrong as I'm... (3 Replies)
Hi!
I have made a simple script for writing the following line on a file (file.txt):
list= 1 2 3
and thr script looks like this:
N=3
ll=(1 2 3)
echo -n "list= ">> file.txt
j=0
while ; do
echo -n ${ll}" ">> file.txt
let j++
done
The code works fine on Linux,... (3 Replies)
I have av script that loops through some statistic files to create a report. We would like to only loop through non-empty files as these files create an empty report-line.
I have figured out how to find the non-empty files, but not how to loop through only those files.
Here is the code that finds... (4 Replies)
Hi,
I am porting one shell script from Linux to AIX. I had .ksh file and i have changed it to .sh file for aix. on linux this script is running fine but on aix it gives me "unexpected end of file" error.
Could any one suggest me what to do to port this script error free?
Thanks in... (6 Replies)