- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: shell script for checking if the system logs a...
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
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
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
03-06-2013 02:38 AM
03-06-2013 02:38 AM
Hi ,
Need a script to check whether system logs are updating .
I have a perl one liner here , from this forum only to check in last 1 hour ;
perl -le 'exit 1 if -M "/var/opt/resmon/log/event.log" > 3600/86400'
But its not working ; my event.log file is not updated for last 3 months , still it doent throw any error.
Any reason why is it so ?
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2013 10:30 AM
03-07-2013 10:30 AM
Re: shell script for checking if the system logs are updating
The fact that your event log is not changing is not necessarily a bad thing. It means that EMS is not detecting any events that it needs to notify you about.
If you want to send a test event to EMS to verify that an event will get logged in that file you can do:
# /etc/opt/resmon/lbin/send_test_event -v disk_em
Then check the /var/opt/resmon/log/event.log file to see if it has the test event. You can also just view this file via 'vi' or 'more' as it is a plain ASCII text file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2013 09:26 PM
03-07-2013 09:26 PM
Re: shell script for checking if the system logs are updating
Hi Patrick ,
Its not about event log not getting updated.
What am saying is the perl liner given above should exit with value 1right , if the event.log is not updated in last 1 hr ?
Its not throwing me value of 1.
Kindly sugeest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2013 12:53 AM
03-08-2013 12:53 AM
SolutionYour one-liner will never produce any output. Instead, it will set its return value to 1 if the condition is true.
In other words, it should work like this:
# perl -le 'exit 1 if -M "/var/opt/resmon/log/event.log" > 3600/86400' # echo $? 1
The return value is often easier to handle in scripts than explicitly catching and interpreting the output. For example, you might do something like this:
#!/bin/sh if perl -le 'exit 1 if -M "/var/opt/resmon/log/event.log" > 3600/86400' then echo "No new events within the last hour" else echo "A new event has been received within the last hour" fi