- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: date increment in file
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-27-2003 10:24 AM
тАО06-27-2003 10:24 AM
echo "PID USER CPU% MEM_SIZE COMMAND"
while true
do
UNIX95= ps -eo "pid ruser pcpu vsz=Kbytes" -o comm | grep oracleD5751
sleep 10
done | sed 's;^;'$(date +'%m%d%H%M%S')' ;'
I execute this file to put the contents into a log.
date > cpu.log ; cpu >> /tmp/junk/cpu.log
However the date time stamp on the output never increments. It prints the first date time and then repeats it with each interation? Any thoughts...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2003 10:34 AM
тАО06-27-2003 10:34 AM
Re: date increment in file
Until your while statement is completed, your sed won't get executed?.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2003 10:37 AM
тАО06-27-2003 10:37 AM
Re: date increment in file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2003 10:38 AM
тАО06-27-2003 10:38 AM
Re: date increment in file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2003 10:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2003 10:45 AM
тАО06-27-2003 10:45 AM
Re: date increment in file
Sorry, substitute 'oracleD5751' for 'vhand' [which I used to test :-)]
#!/usr/bin/sh
echo "PID USER CPU% MEM_SIZE COMMAND"
while true
do
UNIX95= ps -eo "pid ruser pcpu vsz=Kbytes" -o comm |(echo `date +'%m%d%H%M%S'`;grep oracleD5751)|xargs
sleep 10
done
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-27-2003 10:49 AM
тАО06-27-2003 10:49 AM
Re: date increment in file
I would do this
FILE=/tmp/junk/cpu.log
echo "DATE PID USER CPU% MEM_SIZE COMMAND" > $FILE
while true
do
printf "$(date +'%m%d%H%M%S') " >> $FILE
UNIX95= ps -eo "pid ruser pcpu vsz=Kbytes" -o comm | grep oracleD5751 >> $FILE
sleep 2
done
-Sri