Linux Send Output To Particular Mail id or File To Maintain The Log Information


[root@rhel5 ~]#ls -l | sendmail
[root@rhel5 ~]#chkconfig --list | sendmail -F "List Out all the Server"

-F refers To The From Address.
send the mail with the particular text document
sendmail < /etc/crontab

Add Entry In cron tab
#0 2,13 * * * /sbin/ping -c; ls -la >>/var/log/cronrun
It will execute ping and ls -la  command at 2AM and 1PM and it will put the output of command into the log file /var/log/cronrun

it will store the shell script output to the corresponding file /tmp/backup.log file.

Redirect to output
Redirect to error
Redirect to error to standard output
Redirect to input
Pipe standard output to another command
Append to standard output
Pipe standard output and standard error to another command

No comments:
Write comments