On Fri, May 21, 2010 at 3:28 PM, Arun Khan <[email protected]> wrote: > On Wed, May 19, 2010 at 7:47 PM, Parin Sharma <[email protected]> > wrote: > > On Wed, May 12, 2010 at 8:43 PM, Arun Khan <[email protected]> wrote: > >> > >> Arun Sir, it would be nice if you can share that script !! I have been > > searching for such solution for a long time !! > > > > Rather than give you the script it would be better if you write (you > should be able to do in one or two lines in the script) your own > script based on the usage of the following tools: > > 1. 'netstat -nt' to list all TCP connections without DNS resolution > 2. 'egrep' to filter out "ESTABLISHED" connection lines from above > 3. use 'wc -l' to count the number of "ESTABLISHED" connection lines > from above step. and save it in a variable no_conns > 4. invoke '/sbin/poweroff' if no. of $no_conns is -eq 0 > 5. Test the script and when you are satisfied that it works then > 6. In /etc/cron.d/ create a file with crontab entries similar to what > may already be there in that directory. > 7. Edit the min. field for frequency (interval in mins.) and hour > field for the time duration during which your script should be > executed. > > Your "power off" script will run every 'x' min. interval during hours > a through b If you are setup is correct (script and cron entries). > > Caveat: it is assumed you log off from all your ssh/telnet sessions > and also remove any browser tab that refreshes it's respective page > every so often. > > -- Arun Khan > > Thanks Sir !!
-- Parin Sharma http://twitter.com/FOSSmaniac _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
