Bash Line For Constant Monitoring

August 1, 2007

I’ve been doing a lot more bash stuff recently for work and with a book I’m reading. One thing I found handy is this one-liner script to do something every N seconds.

You can replace the sleep 1 with sleep N for a larger interval, and the ps aux | grep ssh | grep -v grep is just what I wanted done every second. The echo "----------[$(date)]------------" is a nice way to separate and mark the timing.

An example run:

Update: (2008-09-23)
Silly me, I just inelegantly rewrote watch

The -n is for specifying seconds between refresh.

Categories: Geek
Tags: , ,

Leave A Comment

Your email will not be published.