- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script for top output every week
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
Forums
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
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
12-12-2007 11:36 PM
12-12-2007 11:36 PM
I need a script which can send top output to one file every week on monday and keep four weeks data.
Pls help
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2007 12:32 AM
12-13-2007 12:32 AM
Re: script for top output every week
To send a top output to a file you can use redirector.
#top >>/tmp/top.out
For every week on monday make entry of the scipt into crontab with timestamp as:
* * * * 1
So, the rough entry in cron will look like :
* * * * 1 path_of_script
In above things each time top output will be append at the last of the /tmp/top/out file. If you want to create new file to each days output then it will need some looping logic into script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2007 12:38 AM
12-13-2007 12:38 AM
SolutionFor top(1), you should be using -f: top -f file
To keep 4 weeks:
top -f file.0
mv file.3 file.4
mv file.2 file.3
mv file.1 file.2
mv file.0 file.1
You need to seed the script for the first time.
>* * * * 1 path_of_script
This runs top every minute. And unless you pass options to top or use -f, it won't stop.
So if you want to run it once at 1 am:
00 01 * * 1 path_of_script
So GSB needs to define what he wants.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2007 01:03 AM
12-13-2007 01:03 AM
Re: script for top output every week
It helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2007 01:12 AM
12-13-2007 01:12 AM