How to make process working in background?

Fabian Keil freebsd-listen at fabiankeil.de
Sun Aug 30 09:56:48 UTC 2015


zhup <zhup at tutamail.com> wrote:

> I have below startup script.
> My question is how to make this process working in background?
> 
> #!/bin/sh
> . /etc/rc.subr
> name=test
> rcvar=test_enable
> command="/usr/sbin/${name}"
> load_rc_config $name
> run_rc_command "$1"

If the program itself has no flag to go into the background
you can use daemon(8) for this:
https://www.freebsd.org/cgi/man.cgi?query=daemon

> Why I am not able to stop this process?
> 
> root at mys:~ # /etc/rc.d/test stop
> Stopping test.
> Waiting for PIDS: 5146 5147Stopping oscam.
> Waiting for PIDS: 5146 5147

Did you verify that the PIDs are correct?
Specifying a pidfile may help.

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20150830/d33b8029/attachment.bin>


More information about the freebsd-questions mailing list