[NTLUG:Discuss] More shell scripting madness

. Daniel xdesign at hotmail.com
Thu Jul 5 14:14:16 CDT 2007


Okay, I just created the i8kfanloop-control.sh and it works exactly the way 
I wanted it to work and it's ever so simple!  That "pgrep" was the enabler 
to make it happen.  Pretty awesome indeed.

Perhaps I will add some sort of "zenity" code to pop up some windows or 
something saying like "it is currently running, do you want to kill it?" or 
"it is not running, do you want to start it?"  But what would be cooler, 
and I fear impossible, would be a way to go into the panel's launcher and 
change the icon!  I wonder if ... heck I guess I can test that manually by 
editing the file by hand.  I'm guessing it wouldn't update though unless 
there's some sort of "update the panel" directive or something... or 
better, "update the launcher."  There must be a way but perhaps not from a 
shell script.


>Consider a front end script called mydaemon-start.sh:
>
>#!/bin/sh
>if pid=$(pgrep mydaemon.sh); then
>         kill -9 $pid
>fi
>
>exec /usr/local/bin/mydaemon.sh &
>
>Where your script is what is inside of mydaemon.sh
>
>You can always add a mydaemon-kill.sh that just does
>the first part, or make the frontend understand
>parameters so you can use the same script to 'start'
>and 'stop' mydaemon.sh

_________________________________________________________________
IE6の機能を強化した最新版ブラウザがMSNユーザー向けになって登場! 
http://promotion.msn.co.jp/ie7/ 




More information about the Discuss mailing list