Re: turn script to daemon?
On Fri, Aug 30, 2002 at 11:12:35AM -0700, Mike Egglestone wrote:
> Hello,
> I have downloaded this unique program.
> (its a binary file of some sort that is used as a database)
> Anyway, I can launch it by typing the command
> # ./atrt.linux &
>
> I can run ps ax and see that the program is running.
> but to kill it, I need to run the kill command.
>
> Is there a way to launch this as a daemon so I can turn it off and on?
> Similar to how apache and samba are launched from /etc/init.d ?
>
> Thanks!
>
> Mike
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>
I believe you might be interested in the bg command. I don't know all
the details but basically you can:
1. run your program:
# ./atrt.linux
Note that I deliberately omitted the & character.
2. Although you were left without a prompt for that shell, pressing
^Z (ctrl-Z) will hopefully send the atrt.linux process the suspend
signal. Alternatively you might send it that signal from another
terminal.
3. You should now get a shell prompt and the atrt.linux process should
be suspended at the background.
4. Now the bg command should let you continue the process execution in
the background.
You might want to look for more details at bash info pages. It has a
section on job control. You can probably see it on the man page too.
As far as I know any modern and POSIX complaint shell supports job
control so that in case you favorite shell isn't bash there should be
no real problem. The commands might be different so that you will have
to look at your shell documentation.
--
Shaul Karl, shaulka@bezeqint.n e t
Reply to: