syslog


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers syslog
# 1  
Old 06-10-2004
Hammer & Screwdriver syslog

Hi everyone:

I need to send completion (or error) message from cronjob to syslog.

How exactly this could be done?

I will appreciate step-by-step instructions: syslog.conf; code in cronjob etc.

Thanks you
# 2  
Old 06-10-2004
Check out the man page for logger - it adds entries to the system log. The man page has examples to place messages via syslog.

I have never tried doing it in the way you suggest so I don't have step-by-step instructions via cron.

(After seeing you quote me I thought maybe I wasn't clear enough...)
1. Sign into your system
2. At your prompt, type man logger
3. Look for the examples

A cron job can be a script that is run - inside the script you can send your messages via logger. To get the completion or error codes from cron, you would have to have the output of the email cron sends - you can't send that to logger but would have to create another script.

Last edited by RTM; 06-10-2004 at 06:48 PM..
# 3  
Old 06-10-2004
Quote:
Originally posted by RTM
Check out the man page for logger - it adds entries to the system log. The man page has examples to place messages via syslog.

I have never tried doing it in the way you suggest so I don't have step-by-step instructions via cron.
# 4  
Old 06-11-2004
Thanks for your reply.

Yea,

I played a little with the logger & it sends a message (or writes to a file) allright.

Now one of my crons is this:
/opt/oracle/v8/bin/exp userid/psswd parfile=/data/syndicate/prod75/admin/export/db11exp.ctl

Success could probably be hardcoded into logger like that

logger -p cron.info -f .../admin/export/exp_syslog.log Succsesful Completion

How could I place an error there?

Thanks again.
# 5  
Old 06-11-2004
It matters what you are looking for. I've got a password script that just does an echo to the messages file on success or failure which looks something like:

echo "`date '+%h %d %T'` `hostname` chgpwd: SUCCESS changing $user passwd" >> /var/adm/messages

As far as logger - just pick a different facility.level for error and use the same type of code you did before.

The real problem is knowing if it failed or not in cron - you could redirect standard error...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. AIX

Cannot send syslog event from AIX 6.1 to RHEL Syslog server

Hi everyone, I am trying to configure AIX 6.1 using syslogd to send syslog event to syslog server configured on RHEL. However, RHEL never receives the events. I have tried to redirect the syslog event on AIX to a local file and successful. Only forwarding to remote server fails. Firewall... (10 Replies)
Discussion started by: michael_hoang
10 Replies

2. Solaris

Which are the available entries to forward syslog in syslog.conf?

Hi Community Which are the available entries to forward syslog in syslog.conf i have put *.err;kern.debug;daemon.notice;mail.crit;user.alert;user.emerg;kern.notice;auth.notice;kern.warning @172.16.200.50 and it's not going through.giving error message like below: syslogd:... (2 Replies)
Discussion started by: bentech4u
2 Replies
Login or Register to Ask a Question