[Om2008.9] power on GPS

Christophe Badoit openmoko at tof2k.com
Wed Oct 29 12:02:10 CET 2008

Matthias Apitz a écrit :
> El día Wednesday, October 29, 2008 a las 09:43:42AM +0000, Alastair Johnson escribió:
>> /etc/init.d/gpsd is a fair place to do it, but it may be overwritten if 
>> you update the gpsd package. I used to use a pair of scripts to start 
>> and stop bluetooth under 2007.2 but they should still work. You could 
>> always combine them with a check on the current power state to make it 
>> toggle, which would be better if you want to add a .desktop file.
> 	...
> There is a bug in the script /etc/init.d/gpsd: When it wants to stop the
> gpsd daemon it uses:
> 	killall gpsd
> which kills the daemon and the script itself:
> # /etc/init.d/gpsd stop
> Shutting down gpsd: Terminated
> I have renamed this script to /etc/init.d/gpsd.sh and now it works fine
> and as well powers down the card writing 0 into the device file;
> 	matthias



instead of

    killall gpsd

There are lots of better solutions :

    pkill -x -o gpsd


    pgrep -x gpsd | grep -v "$$" | xargs -r kill

Or, more standard I think :

    kill `pidof -x -o %PPID "gpsd"`

Or even simpler,

    kill `pidof gpsd`

since, by default, pidof ignores scripts.

Christophe Badoit

More information about the community mailing list