Expectation : @subject
Steps :
1. Create a bash script.
2. add line : exec > >(tee /var/log/my_logfile.txt)
That's it. All output of echo will be saved in this file.
Example :
[root@vm68 log]# cat /etc/init.d/crond |head -2
#! /bin/bash -x
[root@vm68 log]# cat /etc/init.d/crond |head -5
#! /bin/bash -x
exec > >(tee /var/log/my_cron_logfile.txt)
#
[root@vm68 log]#reboot
OP :
[root@vm68 log]# cat /var/log/my_cron_logfile.txt
Starting crond: [ OK ]
As per your need try to modify the script and echo. OP will go to this file.
Wednesday, 10 August 2011
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment