How to stop a daemon?

I have a managed server, on which I started a daemon as per the info at http://www.movabletype.org/documentation/administrator/setting-up-run-periodic-taskspl.html… ‘[the daemon] will never exit and run continuously waiting for work to be done’.

So, how do I stop it?

Hi,

You can use

service daemon_name stop

or

/etc/init.d/daemon_name stop|start

else

find the daemon’s process id using ps command and use

kill -9 pid

to kill the process

Thanks. Appreciated.

The first looks simplest fo rme to understand and use.

Update: I haven’t yet been able to get this working.

Through SSH I ran ‘service run-periodic-tasks stop’ and got the message ‘-bash: service: command not found’.

I also tried the ‘/etc/init.d/daemon_name stop|start’ command and got ‘-bash: start: command not found … Can’t open perl script “daemon_name”: No such file or directory’ messages. Then tried it again with different paths - no better.

Finally I tried ‘ps command’ and had a list of -A, -e, T and r for all processes - but got no further with that.

I don’t pretent to understand much of this, and apologise for asking seemingly dumb questions.

what does:

ps eax | grep periodic

return?

It returns:


 1506 pts/1    SN+    0:00 grep periodic LESSKEY=/etc/lesskey.bin INFODIR=/usr/local/info:/usr/info MANPATH=/usr/local/man:/usr/man:/usr/share/man:/usr/X11R6/man:/usr/share/man/de:/usr/share/man/es:/usr/share/man/fr:/usr/share/man/it XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB TERM=xterm-color SHELL=/bin/bash SSH_CLIENT=81.109.241.104 50460 22 SP_SERVER_IP=87.106.189.1 OLDPWD=/kunden/homepages/39/d289012956/htdocs SSH_TTY=/dev/pts/1 USER=u53748661 XNLSPATH=/usr/X11R6/lib/X11/nls POVRAYOPT=-l/usr/lib/povray/include PAGER=less MINICOM=-c on MAIL=/var/mail/u53748661 PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/local/msql/bin:/usr/games:. PWD=/kunden/homepages/39/d289012956/htdocs EDITOR=vi ignoreeof=0 PS1=(uiserver):\\u:\\w >  HISTCONTROL=ignoredups PS2=>  TEXINPUTS=:~/.TeX:/usr/doc/.TeX LESSCHARSET=latin1 SHLVL=1 HOME=/kunden/homepages/39/d289012956/htdocs LS_OPTIONS=-N  LESS=-M LOGNAME=u53748661 PRINTER=lp LC_CTYPE=de_DE SSH_CONNECTION=81.109.241.104 50460 87.106.189.1 22 LESSOPEN=|lesspipe.sh %s INFOPATH=/usr/local/info:/usr/info COLORTERM=1 _=/bin/grep
 3194 ?        SN    13:08 perl ./tools/run-periodic-tasks -daemon LESSKEY=/etc/lesskey.bin INFODIR=/usr/local/info:/usr/info MANPATH=/usr/local/man:/usr/man:/usr/share/man:/usr/X11R6/man:/usr/share/man/de:/usr/share/man/es:/usr/share/man/fr:/usr/share/man/it XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB TERM=xterm-color SHELL=/bin/bash SSH_CLIENT=81.109.241.104 56562 22 SP_SERVER_IP=87.106.189.1 OLDPWD=/kunden/homepages/39/d289012956/htdocs SSH_TTY=/dev/pts/0 USER=u53748661 XNLSPATH=/usr/X11R6/lib/X11/nls POVRAYOPT=-l/usr/lib/povray/include PAGER=less MINICOM=-c on MAIL=/var/mail/u53748661 PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/local/msql/bin:/usr/games:. PWD=/homepages/39/d289012956/htdocs/domains/misc/businessriffs/apps/mt/riffs EDITOR=vi ignoreeof=0 PS1=(uiserver):\\u:\\w >  HISTCONTROL=ignoredups PS2=>  TEXINPUTS=:~/.TeX:/usr/doc/.TeX LESSCHARSET=latin1 SHLVL=1 HOME=/kunden/homepages/39/d289012956/htdocs LS_OPTIONS=-N  LESS=-M LOGNAME=u53748661 PRINTER=lp LC_CTYPE=de_DE SSH_CONNECTION=81.109.241.104 56562 87.106.189.1 22 LESSOPEN=|lesspipe.sh %s INFOPATH=/usr/local/info:/usr/info COLORTERM=1 _=/usr/local/bin/perl

and then the prompt.

so… you can stop daemon:
kill 3194
check with the same command as before to make sure that there is no process with:
perl ./tools/run-periodic-tasks …

Excellent, thanks.

i wasn’t sure on the exact sytax too use and although I got some errors (the last command I used was kill -3194 which gave the message ‘-bash: kill: 3194: invalid signal specification’) immediately then running ‘ps eax | grep periodic’ showed no unwanted processes running and my system logs for the Movable Type install show that it’s no longer running updates.

So, problem solved - thanks again.

Hi,

You don’t put a - when putting in the process id, so it would be:


kill 3194

not


kill -3194

Thanks,

Ah, thanks.