Results 1 to 2 of 2
Thread: running program as a daemon
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- May 2005
running program as a daemon
i am trying to daemonize my (java) program on ubuntu.
For that end i created a script based on /etc/init.d/skeleton script which obviously uses start-stop-daemon.
I put the script to /etc/init.d
I added symbolic link to it for the runlevel 2.
But I cannot make the process (java program) run on the background. it keeps running in the same terminal i start my daemon script. Trying --background option for start-stop-daemon does not help.
This is a remote server to which i can only login via telnet.
Any ideas what is missing here?
- Join Date
- Nov 2008
- Tokyo, Japan
All daemons behave like that, its completely normal behavior.
A daemon is just an ordinary program, and it is up to the programmer to designed the daemon program to ignore the standard input and standard output. So if your program does not explicitly call System.out.close() and System.err.close(), all output produced by your program will continue to flow to these file handles. And the input/output/error file handle for ALL programs, daemon or not, is the terminal which executed it.
So it may run in the background, but if it produces output, your terminal is still receiving that output. You can try this in a Bash command line:Code:
java MyDaemon &>/dev/null & disown