Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Script when scheduled in Crontab gives extra records in output Post 303041281 by ab095 on Wednesday 20th of November 2019 05:46:27 AM
Old 11-20-2019
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.9 (Tikanga)
Release: 5.9
Codename: Tikanga

Code:
#!/bin/bash
host=`hostname`
while read LINE
do
        subscription=`echo $LINE | cut -d ':' -f1`
        src=`echo $LINE | cut -d ':' -f2`
        target=`echo $LINE | cut -d ':' -f3`
        /e00/ibm/access_server/bin/chcclp -f /home/cdc_access/scripts/Subscription_Latency.cmd source:$src target:$target subscription:$subscription >/home/cdc_access/scripts/Status.log
        if `grep -q "not mirroring" /home/cdc_access/scripts/Status.log`
        then
                latency=`echo "NULL"`
                substatus=`echo "Not-Mirroring"`
                echo -e "$subscription\t$src\t$target\t$substatus\t$latency">>/home/cdc_access/scripts/LatencyStatus.csv
        else
                awk '(NR==21)' < /home/cdc_access/scripts/Status.log > /home/cdc_access/scripts/outputfile.txt
                sec=`awk '{print $(NF)}' </home/cdc_access/scripts/outputfile.txt`
                substatus=`echo "Mirroring"`
                latency=`echo - | awk -v "S=$sec" '{printf "%dh:%dm:%ds",S/(60*60),S%(60*60)/60,S%60}'`
                echo -e "$subscription\t$src\t$target\t$substatus\t$latency">>/home/cdc_access/scripts/LatencyStatus.csv
        fi
done </home/cdc_access/scripts/SubscriptionList.cfg;
EMAIL_ID=`cat /home/cdc_access/scripts/MailList.cfg`;
awk -v EMAIL_ID="$EMAIL_ID" -v host="$host" ' BEGIN{
print "From:XXXXXXXXXXXXXX@"host
print "TO: "EMAIL_ID
print "MIME-Version: 1.0"
print "Content-Type: text/html"
print "Subject: IIDR Subscription Latency Status on Production"
print "<html><body><p>Hi Team,<br /><br />Please find the below status of the IIDR Subscriptions and their latency.</p><table border=2 cellspacing=0 cellpadding=3"
print "<tr>"
print "<td bgcolor="blue"><b>Subscription Name</b></td>";
print "<td bgcolot="blue"><b>Source Datastore</b></td>";
print "<td bgcolor="blue"><b>Target Datastore</b></td>";
print "<td bgcolor="blue"><b>Subscription Status</b></td>";
print "<td bgcolor="blue"><b>Latency(hh:mm:ss)</b></td>";
print "</tr>"
}{
print "<tr>"
print "<td>"$1"</td>";
print "<td>"$2"</td>";
print "<td>"$3"</td>";
print "<td>"$4"</td>";
print "<td>"$5"</td>";
print "</tr>"
}END{
print "</table><p>IBM Infosphere Data Replication Monitoring Script</p></body></html>"
} ' LatencyStatus.csv | /usr/sbin/sendmail -t
rm -f  /home/cdc_access/scripts/LatencyStatus.csv
rm -f  /home/cdc_access/scripts/outputfile.txt
rm -f /home/cdc_access/scripts/Status.log

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with executing a script scheduled in crontab

Hi I have written a shell script(in Solaris) in which following logic is there..... i=1 while read control do key=`echo $control | awk -F$DELIMITOR '{ print $1 }'` echo "Key Values" ${key} i=`/usr/bin/expr $i + 1` done < $CONFPATH/$CONFFILE when i execute it at prompt it... (4 Replies)
Discussion started by: Amardeep
4 Replies

2. Shell Programming and Scripting

Extra output in the script

Hi , I am trying to execute the following script. #!/bin/sh find . -name "common.log.diff" if ; then cp common.log common.log.diff diff common.log common.log.diff > DIFFERENCE.log cp common.log common.log.diff grep "ERROR" DIFFERENCE.log if ; then echo "1" else echo "0" fi... (5 Replies)
Discussion started by: himvat
5 Replies

3. UNIX for Dummies Questions & Answers

crontab scheduled details required

Hi, I have the below job scheduled in crontab. Can you please tell me at what interval this job is scheduled? Where is the name of the job defined here? I will definitely go through the UNIX documentation a little later, for the time being, please provide me few details on this. Thank you. ... (0 Replies)
Discussion started by: Dev_Dev
0 Replies

4. Shell Programming and Scripting

Ascii Mode appending extra records to csv file

I am relatively new to this forum and Unix scripting. ksh script: part 1 :will call a PL\SQL program will create 3 CSV file at the unix directory. part 2 : will sftp the files to the EFT server. Once the EFT server receives these file , it will transfer them to a shared windows folders. ... (3 Replies)
Discussion started by: developerpa
3 Replies

5. Shell Programming and Scripting

Compare two files with different number of records and output only the Extra records from file1

Hi Freinds , I have 2 files . File 1 |nag|HYd|1|Che |esw|Gun|2|hyd |pra|bhe|3|hyd |omu|hei|4|bnsj |uer|oeri|5|uery File 2 |nag|HYd|1|Che |esw|Gun|2|hyd |uer|oi|3|uery output : (9 Replies)
Discussion started by: i150371485
9 Replies

6. Shell Programming and Scripting

Why my git command has no output in crontab but works well run this script manually?

cat /home/lyang001/update.sh #!/bin/sh #shopt -s expand_aliases HOME_DIR=/home/lyang001/updates UPDATE_MAIL=${HOME_DIR}/updates.mail rm $UPDATE_MAIL -rf cd $HOME_DIR/wr-kernel git log --no-merges --since="20 day ago" --name-status --pretty=format:"%an %h %s %cd" origin/WRLINUX_5_0_1_HEAD >>... (2 Replies)
Discussion started by: yanglei_fage
2 Replies

7. Red Hat

Script not working if crontab scheduled

Hi all, I'm working to a script with /bin/bash shebang. The script works perfectly if I run from command line. The script runs under a non root user and inside the commands are set with sudo command in a such a way they can be run under root, for example (first rows of the script):... (5 Replies)
Discussion started by: idro
5 Replies

8. Shell Programming and Scripting

Scheduled job not running automatically in crontab

i have a job scheduled in crontab. The problem is, it is not running automatically as per the time scheduled. But runs when executed manually. What would be the problem? Help me with this please. (6 Replies)
Discussion started by: Santhosh CJ
6 Replies

9. Shell Programming and Scripting

Log file is not updating when I run shell scripts scheduled thru crontab

Hi Forum, Good Day! I have created an empty html file wtih permissoin 777 created shell script(with permission 777) , code is below. #=======================start============== . /data09/oracle/apps_st/appl/D_oraapp095.env rm -rf /home/mnp/Test_log.txt echo... (1 Reply)
Discussion started by: kartheekbk
1 Replies

10. UNIX for Beginners Questions & Answers

Script gives error when scheduled in crontab

i have written one script which is working fine when i run it manually but giving error when i schedule it in crontab. cat SUMMARY.sh #!/bin/bash DT1=`date +%Y%m%d` echo "Off PP TT" >>summary_$DT1.txt cat ues1.txt_$DT1 >>summary_$DT1.txt cat ues2.txt_$DT1... (2 Replies)
Discussion started by: scriptor
2 Replies
PODRACER(1)						      General Commands Manual						       PODRACER(1)

NAME
podracer - A podcast aggregator with BitTorrent support SYNOPSIS
podracer [-c|-catchup|--catchup|catchup] podracer [-v|-version|--version|version] DESCRIPTION
Podracer is a podcast downloader. It takes a file with the URLs to all your podcast rss feeds and goes and gets the mp3s and stores them in a specified location. It is a BASH script with an internal BitTorrent downloader written in Python. OPTIONS
-c, -catchup, --catchup, catchup Run podracer in catchup mode. RSS feeds are retrieved and their enclosures are reported to the user's log, but no podcasts are downloaded. -v, -version, --version, version Show Podracer version information and exit. SUBSCRIPTIONS
Podcast subscriptions are stored in a file typically named ~/.podracer/subscriptions. Each line of the subscription file consists of a URL to a podcast feed and its optional corresponding download directory name separated by a space or tab. Any line that is blank or that does not begin with a URL or the absolute path to a local file name is ignored. If a download directory is specified in the subscription file, it will be created under the directory specified by the poddir config option. If no download directory is specified, the shows will be stored directly in poddir. A sample subscription file is included with Podracer, and can be created in a user's directory when running Podracer for the first time. AUTHOR
Podracer and its man page are written by Lorenzo Taylor <lorenzo@taylor.homelinux.net>. See the CREDITS file for other contributors. LICENSE
Podracer may be freely used, distributed and modified subject to the terms of the MIT License. See LICENSE for details. podracer 19 February 2006 PODRACER(1)
All times are GMT -4. The time now is 09:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy