[Ilugc] My deceptively simple shutdown script after music playsq

  • From: ravi.goglobium@xxxxxxxxx (Ravi Jaya)
  • Date: Wed May 12 13:38:08 2010



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

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

[-------------------------------------------------------------------------------------]

Above script looks good, but I like to propose my modifications in that.

#!/bin/sh
echo "Checking for mplayer..."
stat=`pgrep mplayer`
 if [ "$stat" = "" ]; then
                       shutdown -hP now
  fi

Love to save the above script as the watchdog.sh. Instead of going for a
infinite loop with sleep command,  I would add script along with watch as

$watch ./watchdog.sh


-- 
Ravi Jaya

Mobile: +91 97909 16181

Other related posts: