From owner-freebsd-questions@freebsd.org Sun Aug 30 09:56:47 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E32939C4ED6 for ; Sun, 30 Aug 2015 09:56:47 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay02.ispgateway.de (smtprelay02.ispgateway.de [80.67.31.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4B6CFF3 for ; Sun, 30 Aug 2015 09:56:47 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from [78.35.187.140] (helo=fabiankeil.de) by smtprelay02.ispgateway.de with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1ZVzKd-00012O-1z; Sun, 30 Aug 2015 11:55:23 +0200 Date: Sun, 30 Aug 2015 11:55:24 +0200 From: Fabian Keil To: zhup Cc: freebsd-questions@freebsd.org Subject: Re: How to make process working in background? Message-ID: <2ac65a7c.445eda7a@fabiankeil.de> In-Reply-To: <1440834990532-6035821.post@n5.nabble.com> References: <1440834990532-6035821.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/h2CM1Lhs3lY98BY+7D5jXqF"; protocol="application/pgp-signature" X-Df-Sender: Nzc1MDY3 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Aug 2015 09:56:48 -0000 --Sig_/h2CM1Lhs3lY98BY+7D5jXqF Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable zhup wrote: > I have below startup script. > My question is how to make this process working in background? >=20 > #!/bin/sh > . /etc/rc.subr > name=3Dtest > rcvar=3Dtest_enable > command=3D"/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=3Ddaemon > Why I am not able to stop this process? >=20 > root@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 --Sig_/h2CM1Lhs3lY98BY+7D5jXqF Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlXi0wkACgkQBYqIVf93VJ2g4wCgsK576RXGmHNrp37znvvYz+sF OtIAoIbbUe4CrazkQKUmSnoV0IZ7J/rp =JHPJ -----END PGP SIGNATURE----- --Sig_/h2CM1Lhs3lY98BY+7D5jXqF--