- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Logger Command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:33 PM
тАО10-10-2001 11:33 PM
Logger Command
I am running one script which will automatically run by using cronjob..So i need to use the LOGGER in HP-Unix command to automatically return the status of that file to SYSLOG.LOG
Can anyone help me how to use this LOGGER command...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:37 PM
тАО10-10-2001 11:37 PM
Re: Logger Command
/usr/bin/logger "this is a test" will produce the fpllowing entry in /var/adm/syslog/syslog.log
Oct 11 09:37:16 mars bongartz: this is a test
Regards
Rainer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:45 PM
тАО10-10-2001 11:45 PM
Re: Logger Command
Thank you for your reply..
So if i include this command :
/usr/bin/logger "The test is successfull"
in my shell script ,it will automatically returns to the syslog..
How can i identify whether that script is successfull or not successfull ?? How can i check the condition in the shell script..??
Thanks for the advance in help.
Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:45 PM
тАО10-10-2001 11:45 PM
Re: Logger Command
As a quick test, type:
logger hello
This should add a line to /var/adm/syslog/syslog.log
You can control which logfile to send to using the -p switch. This will send to the logfile as configured in syslog.conf, so:
echo hello | logger -d mail.debug
will probably end up in /var/adm/syslog/mail.log because of the line:
mail.debug /var/adm/syslog/mail.log
in syslog.conf. You can also dump the contents of a file (-f), add the process id (-i), change the tag (-t).
I'd just play around with it, and keep another window open that is tailing the logfiles:
tail -f /var/adm/syslog/syslog.log (or whatever).
Also "man 1 logger".
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:51 PM
тАО10-10-2001 11:51 PM
Re: Logger Command
Within your script, check the return code of commands, e.g. to check if a file exists:
test -f /tmp/dummy
if [ $? -eq 0 ] ; then
logger "/tmp/dummy exists"
else
logger "/tmp/dummy missing"
fi
When you wish to terminate a script, use the "exit" command to set the return code. You can then test this as above, and log accordingly.
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:53 PM
тАО10-10-2001 11:53 PM
Re: Logger Command
yout script should check the return values (echo $?) of the commands.
if [[ $? != 0 ]]
then
print "cmd not OK!"
else
print "cmd ok "
fi
or something like this
Reagards
Rainer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2001 11:56 PM
тАО10-10-2001 11:56 PM
Re: Logger Command
logger "cmd not ok" instead of
print "cmd not ok"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 12:47 AM
тАО10-11-2001 12:47 AM
Re: Logger Command
I will try now with all the option that you all have given to me and let you know the results..
Thanking you
Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 01:11 AM
тАО10-11-2001 01:11 AM
Re: Logger Command
if [[ $? != 0 ]]
then
logger -p user.err "cmd not OK!"
else
logger -p user.notice "cmd ok "
fi
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2001 07:50 PM
тАО10-11-2001 07:50 PM
Re: Logger Command
Thank you all for the Help..
Thanks & Regards
Rajkumar