Hello everyone,

Here is a very simple recipe for a common need.

I have been wanting to automatically switch off my machine after the
music stops playing.

This could be at night or during daytime when you lock your house and leave.

This simple shell script does a great job when run as root.

But remember that you should be able to switch off the machine in
software. APM support has to work.

Nowadays it is no issue.

Here is the silly program that does the job.

[-------------------------------------------------------------------------------------]
#!/bin/sh

while [ "1" = "1" ]; then
do
           sleep 15
           echo "Checking for mplayer..."
           stat=`pgrep mplayer`
           if [ "$stat" = "" ]; then
                        shutdown -hP now
           fi
done
[-------------------------------------------------------------------------------------]

Since I only play music using mplayer this works for me. You need to
choose some other audio/video player in
case you are not like me.

Hope it is useful in some strange way.

Thanks.

-Girish
-- 
Gayatri Hitech
web: http://gayatri-hitech.com

SpamCheetah Spam filter:
http://spam-cheetah.com
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc

Reply via email to