- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Script
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
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
тАО06-07-2007 12:08 AM
тАО06-07-2007 12:08 AM
Things I wanted was a bdf from 3 servers and syslog.log (YESTERDAYS DATE) with only Critical errors
and any users who were still logged in since yesterday.
Can you please help. the problem I am getting is Yesterdays date
Solved! Go to Solution.
- Tags:
- bdf
- date arithmetic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2007 12:16 AM
тАО06-07-2007 12:16 AM
Re: Script
You can parse the output of this into any pieces you want:
# perl -le 'print scalar localtime(time-86400)'
...or use:
# perl -MPOSIX=strftime -le 'print strftime "%m/%d/%Y",localtime(time-86400)'
The second snippet allows you to chose the format of the output. The directives are the same ones available with the standard Unix 'date' command. See the manpages.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2007 12:19 AM
тАО06-07-2007 12:19 AM
Re: Script
One solution is you put it in a file initially and then the next day you use that. Then you put the current date, to use for the next day.
If you skip a day, you'll end up doing everything back to the last time, that may be good or bad for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2007 12:20 AM
тАО06-07-2007 12:20 AM
Re: Script
This question seems to come up a lot.
See this thread for details on how to calculate yesterday's date:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=563529
For small date offsets, you can adjust $TZ:
$ YESTERDAY=$(TZ=$TZ+24 date +%Y%m%d)
For larger offsets, there's A. Clay's Stephenson's "Date Hammer script": caljd.sh.
PCS
- Tags:
- caljd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2007 12:40 AM
тАО06-07-2007 12:40 AM
Solution> and syslog.log (YESTERDAYS DATE) with only
> Critical errors and any users who were
> still logged in since yesterday.
SLPATH=/var/adm/syslog
YESTERDAY1=$(TZ=$TZ+24 date +"%Y%m%d")
YESTERDAY2=$(TZ=$TZ+24 date +"%b %e")
echo [server1] bdf output:
bdf
echo [server1] critical errors from yesterday's syslog:
grep -i -E 'critical|
echo [server1] users logged in since yesterday:
who | grep "${YESTERDAY2}"
echo [server2] bdf output:
ssh server2 bdf
... and so on ...
Replace
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2007 12:51 AM
тАО06-07-2007 12:51 AM