Shell Script to grep Job File name and Log File name from crontab -l
Hello,
I am new to shell scripting. I need to write a shell script where i can grep the name of file ie. .sh file and log file from crontab -l.
In crontab -l, there are many jobs, i need to grep job name like 'refresh_ug634.sh' and corresponding log name like 'refresh_ug634.sh.log '.
I am thinking of making a universal script that can grep job name, log name and hostname for one server.
Then, suppose i modify the refresh_ug634.sh script and call that universal script and echo those values when the script gets executed.
Please can anyone help.
All i need to do is have footer in all the scripts running in crontab in one server.
job file name
log file name
hostname
Please suggest if any better solution. Thanks.
I just need to get those three information in every crontab shell script at footer running on that server.
Shell script :- location of the script
Log location :- log file name and location
Sever job ran :- server name
I have to append the disclamer on email for every shell script with above info
Last edited by Franklin52; 09-09-2012 at 11:20 AM..
Reason: Please use code tags
Hi expert, Need help in shell script.
a.txt file output is below
i would like to grep 3 line and 1st column value which is admin\22226 only and not full line. i only know admin word as 22226 can come anything with admin\ in file.
also after fetching it i would like to use this... (1 Reply)
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)
I am looking for HTML code that browse text file and grep with database file then retrieve result
txtfileuploaded contain
112233
115599
113366
shell code
grep -F -f txtfileuploaded /data/database.txt
result
112233 Mar 41$
115599 Nov 44$
113366 Oct 33$
attached... (2 Replies)
I am a newbie to Unix.
My default root user umask is set to 077 and I have the following crontab job to redirect al the backup output to the logfile of /backup/backup.xxxxx
00 10 * * 0 /usr/local/bin/backup.sh > /backup/backup.`date +\%Y\%m\%d` 2>&1
Since root default umask is 077, the... (2 Replies)
I need to write a script, which takes the input a log file and create output file with acct no's line by line from selected records with text like (in red) :
18:51:18 | 217863|Acct 0110855565|RC 17608| 16 Subs| 1596 UsgRecs| 2 Secs| 430 CPUms| prmis2:26213 <MoveUsage d
aemon needs to run... (7 Replies)
Is it possible to add a job to crontab with a shell script? The existing jobs in the crontab should exist as it was. The new job should be appended.
Also, the crontab file is /var/spool/cron/root. (1 Reply)
Dear Friends,
I am working on IBM AIX. I have written one script and kept in the crontab as to run daily at 11:38 AM. and the output of the script to be appended to the file generated with the month name. but my file deleting daily and the new file is creating with the output of the shell... (2 Replies)
Hey,
MAILTO=cron@domain.ca
*/20 * * * * /usr/bin/wget http://list.domain.ca/admin/consume.php >/dev/nullthats what the crontab is setup todo, so basically every 20minutes it runs consume.php
In my root directory, i'm getting files like this:
consume.php
consume.php1
consume.php2
i woke... (3 Replies)
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (1 Reply)