Having a single Log file for all the shell scripts
Bash on RHEL 6.2
We have multiple shell scripts executed by cron jobs. Each Shell script has its own log files currently. Most of them have logs generated using spool command from Oracle RDBMS's sqlplus commmand.
Sample:
Now, our log monitoring team wants to have just one log file where all the shell scripts will scripts write to. We'll call it the 'CentralLogFile.log' for this discussion.
They say it is easy for their log mining tools to search for keywords in one log file rather than multiple log files. They will rotate this CentrallogFile file on a monthly basis.
But, I do not want to stop the current way of shell scripts generating separate log files for each execution. I want the shell scripts to write to both the CentralLogFile and the dedicated log file.
I found a simple & Elegant solution by Corona in the following link
So, is it OK if use the following commands in red lines in all of my scripts so that it will write to the central log as well ?
Do you see any drawbacks, issues with this approach ?
Bash on RHEL 6.2
. . .
But, I do not want to stop the current way of shell scripts generating separate log files for each execution. I want the shell scripts to write to both the CentralLogFile and the dedicated log file.
I don't think it will work.
1) the exec redirection will redirect stdout and stderr to some file, but the sql spool directive will open a new file without considering the redirection. It might work if you drop the spool.
2) With your exec you only open/redirect to one single file. There's nothing done to write dedicated AND central log files. The tee command provides a second etc. output stream, but I don't know how it could be used for this request.
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)
Hi Folks,
I have two scripts that are used to start and stop services these scripts are at the location /opt/app/tre , so that start.sh internally starts the components and stop.sh internally stop all the components, now rite now if I have to stop the services then i need to go first the... (9 Replies)
Hi friends
please help me on below,
i have 5 files like below
file1 is
x 10
y 20
z 15
file2 is
x 100
z 245
file3 is
y 78
z 23
file4 is
x 100 (3 Replies)
Hi Friends,
I have a shell script which does some operations etc, would it be possible to create an executable file out from this shell script? meaning the executable file is not editable, thus the source code will not be visible to other users for copyright reasons.
Please help, thanks! (1 Reply)
Need shell script to read two file at same time and print output in single file
Example I have two files 1) file1.txt 2) file2.txt
File1.txt contains
Aaa
Bbb
Ccc
Ddd
Eee
Fff
File2.txt contains
Zzz
Yyy
Xxx (10 Replies)
Hi gurus out there,
1)I am using ksh, in solaris 10.
2)I have one ldif file, I need to output user DN with attributes=<some pattern> to a file.
Example:
dn: uid=joy,ou=People,o=abc.com,o=isp
nswmExtendedUserPrefs: meAutoSign=true
nswmExtendedUserPrefs: meSignature=Regards, Joy... (3 Replies)
I have a program (say, MyProgram) written in Bourne-shell script, but at some point it calls another script written in pearl, as illustrated below:
#!/bin/sh
.....
case $x in
1) ConfigSystem1 ( b-shell script)
2) ConfigSystem2 ( pl)
3) ConfigSystem3 (b-shell)
....
Then I create... (0 Replies)
ftp -n -v <<EOF
verbose
open 3.57.40.79
user infodvlp pr0gram
ascii
lcd /home/a501420038/GLA/Success_Load/
cd /ftp/SrcFiles/csg/InstruAsia/
get AU_Success_Log.txt
close
quit
EOF
Please help on this, this gives the out put "AU_Success_Log.txt?" As question mark in the last what will... (1 Reply)
If someone out there could help me out with this problem. I would really appreciate it.
I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts.
My xml file:
<root>
<header_rec recordtype="00">
<record_id>00</record_id>
<country_code>AK></country_code>... (0 Replies)