How to Stop GPSD daemon?

6,512

As you can read from service man page:

service --status-all runs all init scripts, in alphabetical order, with the status command. The status is [ + ] for running services, [ - ] for stopped services and [ ? ] for services without a 'status' command. This option only calls status for sysvinit jobs; upstart jobs can be queried in a similar manner with initctl list.

So, answering your question, YES, it is stopped.

To get the status of any daemon with the following:

start-stop-daemon -T --name gpsd

or if you know gpsd's PID:

start-stop-daemon -T --pid 0123

To kill/stop it, run any (note that the -K is a capital letter):

start-stop-daemon -K --name gpsd
start-stop-daemon -K --pid 4567

Sources:

start-stop-daemon man pages for 14.04

service man pages for 14.04

Share:
6,512

Related videos on Youtube

Nate Duong
Author by

Nate Duong

Updated on September 18, 2022

Comments

  • Nate Duong
    Nate Duong over 1 year

    I am trying to use the GPSD as a server, that is: everything must be done by command line, such as: gpsd --help.

    I read the documentation here, which says that.in order to let gpsd work as server, you need to stop or kill the gpsd daemon first.

    But I do not know how.

    I ran service --status-all and it shows me the list of running daemons, which included gpsd:

    [ - ]  gpsd
    

    is it still working or stopped?

    I also tried to use start-stop-daemon -k but it did not work, I just get shown the help when I try that.

  • M. Becerra
    M. Becerra about 7 years
    @Zanna changed it, hope it's better now
  • Zanna
    Zanna about 7 years
    seems fine now, +1. Unfortunately it wasn't me who downvoted so not able to fix that
  • M. Becerra
    M. Becerra about 7 years
    It's okey. I appreciate your feedback, @Zanna, I count on being able to improve my answers/contributions :)
  • Nate Duong
    Nate Duong about 7 years
    @M.Becerra: Thank you for your answer, I tried to use this command start-stop-daemon -K --name gpsd and I received this message:"No gpsd found running; none killed." and I thought daemon has stopped, but when I check the service --status-all it still shows the [ - ] , and I guess gpsd is not working as server yet.
  • Nate Duong
    Nate Duong about 7 years
    @M.Becerra : when I use start-stop-daemon -T --name gpsd to see status, I see nothing.
  • M. Becerra
    M. Becerra about 7 years
    First of all, make sure gpsd is running as a daemon ps -C "$(xlsclients | cut -d' ' -f3 | paste - -s -d ',')" --ppid 2 --pid 2 --deselect -o tty,args | grep ^? | grep gpsd if it is, kill it with sudo killall gpsd and sudo rm /var/run/gpsd.sock , according to the documentation provided by yourself.
  • Nate Duong
    Nate Duong about 7 years
    @M.Becerra : just used ps -C "$(xlsclients | cut -d' ' -f3 | paste - -s -d ',')" --ppid 2 --pid 2 --deselect -o tty,args | grep ^? | grep gpsd and put this command in terminal, then press enter key , I see nothing happen,
  • M. Becerra
    M. Becerra about 7 years
    That means gpsd is not running as a daemon. If you still want to be sure no instance of gpsd is running, do ps ax | grep gpsd, again, if theres no ouput, it means it is not running.
  • Nate Duong
    Nate Duong about 7 years
    @M.Becerra : sudo killall gpsd and sudo rm /var/run/gpsd.sock are used: root@Lab-X230:/home/igor# sudo killall gpsd give me gpsd: no process found, and root@Lab-X230:/home/igor# sudo rm /var/run/gpsd.sock give me rm: cannot remove '/var/run/gpsd.sock': No such file or directory
  • Nate Duong
    Nate Duong about 7 years