View Full Version : comando TOP
vorrei realizzare un piccolo script per monitorare utilizzo CPU da parte di un programma usando TOP.. qualcuno di voi ha gia realizzato qualcosa del genere?
vampirodolce1
30-07-2008, 10:27
Ti rispondo anche qua:
Top prevede anche un uso batch con l'opzione -b:
-b : Batch mode operation
Starts top in 'Batch mode', which could be useful for sending output from top to other programs or to a file. In this mode, top will not accept input and runs until the iterations limit you've set with the '-n' command-line option or until killed.
Una volta ottenuta la lista puoi selezionare la riga del tuo processo (grep) e la colonna della CPU (cut). Metti tutto in un ciclo while con temporizzatore (sleep) e hai il tuo bel monitor.
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.