Hi Guys, I'm very new to Shell scripting and have to design a code which I'm not able to find a way to. I will try to explain the aim in detail and shall be obliged if anyone could help me with the coding snippet.
I have an input file who's every row has a few details about an autosys Job. I shall write down the first entry of the file so that should give an idea :-
So in each row of the file there is a command Job name, for which there is an expected starting date and time in the input file itself. These two things are given in the input file itself. I have to now extract the latest log of this command job, from it's header extract the start time and compare it with the expected start date and time in the input file, if the extracted date and time from the log are greater than the expected one, it is indeed the log for that day and not a previous log. Also, the time in the log is of 24 hour format and the one in the input file is 12 hour.
Furthermore, for every row, after doing the above analysis, I have to add two more columns which are completion time if it is has completed and the current status of the Job i.e Scheduled, Running, Completed and failed.
If the Job has completed or failed, the log's last line shows "++++COMPLETED++++" or "++++FAILED++++" so maybe that can be used.
Please help me in coding the above scenario. Any assistance shall be of great help. Please help guys!!
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 03-12-2017 at 05:31 PM..
Reason: Added CODE tags.
To put people in a position to decently help you, a clear and precise specification of the problem is absolutely compulsory, including OS version, problem description, input sample, desired output, and preferred tools (like awk, sed, shell script, else).
Looking at your above post, only a fraction of these is supplied. We find one (of two) input file's structure (NO data!) - that's it. Wildly guessing, we could propose sth. that might do what we feel is what you request, but chances are small we hit the bull's eye.
Why don't you start over and supply a decent spec?
I have a script
#!/bin/bash
HOST=ftp.example.com
USER=ftpuser
PASSWORD=P@ssw0rd
ftp -inv $HOST <<EOF
user $USER $PASSWORD
cd /path/to/file
mput *.html
bye
EOF
the script executes sucessfully I need to capture the FTP logs to a logfile
should contain
FTP Login successful
... (1 Reply)
Hi Guys, I'm very new to Shell scripting and have to design a code which I'm not able to find a way to. I will try to explain the aim in detail and shall be obliged if anyone could help me with the coding snippet.
I have an input file who's every row has a few details about an autosys Job. I shall... (0 Replies)
I have a file that is created via a perl script where the file is named like so: 01-07-2016_10:17:08. I am running a shell script that needs to take this file and print it. I can capture the date portion fine, but I am unsure how to capture the time stamp, since there will be a difference from what... (1 Reply)
I have two set of questions.
1) To skip killing some process automatically.
2) To kill other process and capture their log.
I have set of process, some needs to be killed gracefully and others should be skipped.
Listed are the process.
adm 1522... (1 Reply)
Hi,
I have been trying to capture console logs from the init script.
When the ramfs is mounted, i check if usb is connected , if conncted, i mount it and redirected the console logs like so:
cat & /dev/ttyS1 >> /mnt/logs.txt
I'm getting
/bin/sh : /dev/ttyS1 :permission denied
... (8 Replies)
Hi Guys,
I am trying to capture the FTP Logs in a log file.
I am using the below code.
ftp -d -n -v $Remote_Host << EOD > $Ftp_LOG;
Since iam running the script in debug mode, i am able to see that the ftp is done and the file has been transferred.
But the log file does not have... (7 Replies)
Newbie question:
I wrote korn shell script that lets me connect to a cisco switch thru telnet from sun server. I'm wodering if or what command i would use to capture info that is being sent to standard output when the script is running. Putting part of my script below and results.
#!/bin/ksh... (2 Replies)
Hi All,
I am working on a korn shell script.
I have a problem.i am calculating the next 27 hours
from the time stamp.
say TSTAMP=20060724000000
if i add 27 hours to the above time stamp,
i will get 20060724143000
this is the code:
YEAR=`echo $TSTAMP | awk... (0 Replies)
Hi All,
I am working on a korn shell script.
i have a file such as:
DS.PETSCO.20060601203514.20060531.ctl_20060717124431
i have 2 problems here.
1) i have to capture the time stamp from
the above file i.e this number 20060717124431.
format of time stamp is YYYYMMDDHHMMSS.
can... (4 Replies)