Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing a script until prompted

Status
Not open for further replies.

teakandme

MIS
Jun 10, 2004
57
US
I was hoping someone could advise how to write a for or while loop to refresh a script until prompted to stop.

I have a script that monitors the state of printers and want to have this refresh to the screen every 2 minutes until prompted to stop .... when there is an issue, would like to stop the refresh to fix/research the problem.

Anyone have any ideas?
 
#!/bin/sh
while true
do
echo "Run your script here. And change the refresh time in sec s below"
sleep 60
done

This will run until you give a Ctrl + c or kill the process

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top