Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Shell Script to grep Job File name and Log File name from crontab -l

960707Sep 7 2012 — edited Sep 7 2012
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.

#51 18 * * * /home/oracle/refresh/refresh_ug634.sh > /home/oracle/refresh/refresh_ug634.sh.log 2>&1
#40 17 * * * /home/oracle/refresh/refresh_ux634.sh > /home/oracle/refresh/refresh_ux634.sh.log 2>&1

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2012
Added on Sep 7 2012
8 comments
258 views