| | |
Simple script loop question
![]() |
•
•
Join Date: May 2006
Posts: 2
Reputation:
Solved Threads: 0
Hey all. Thanks in advance for any help you can give, hopefully this is an easy one. I want to create a loop to run a simple performance monitor like vmstat and record it to a file, but have very limited scripting skills.
Starting with this...
date >> /var/log/perfmon.log
vmstat 3 10 >> /var/log/perfmon.log
I basically want it to sleep for 5 minutes using sleep 300, but how do I start the process again (restart the loop)?
Thanks
Starting with this...
date >> /var/log/perfmon.log
vmstat 3 10 >> /var/log/perfmon.log
I basically want it to sleep for 5 minutes using sleep 300, but how do I start the process again (restart the loop)?
Thanks
•
•
Join Date: May 2006
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by kamitsin
while true
do
date >> /var/log/perfmon.log
vmstat 3 10 >> /var/log/perfmon.log
sleep 300
done
but instead of giving a sleep of 5 minutes why don't you cron the whole thing. Schedule the commands so that they run after every 5 min.
Amit
thanks! ![]() |
Similar Threads
- A simple question about istrue of Ant. (Java)
- Really simple script request - Count from 6 - 0 (JavaScript / DHTML / AJAX)
- Javascript - how to stop/halt/break this loop/script plss (JavaScript / DHTML / AJAX)
- A simple script to execute a command package (Shell Scripting)
- How to loop inside application via script (Shell Scripting)
- need help w/for loop (C++)
Other Threads in the Shell Scripting Forum
- Previous Thread: help with my fist script
- Next Thread: automated email on a log event
| Thread Tools | Search this Thread |





