Talk:Run as a daemon or service: Difference between revisions

From Rosetta Code
Content added Content deleted
(Bad definition?)
 
Line 1: Line 1:
== Bad definition? ==
== Bad definition? ==


It's probably better to describe a daemon as a process that runs in the background and independent of a user's login session, if anything. "Not connected to a terminal" isn't quite it, a daemon could print to a tty all day if it wants to. Also, why do you want a daemon process to both detach from stdout ''and'' print to stdout? Wouldn't it be saner to have it directly write to a file to begin with? --[[User:Ledrug|Ledrug]] 08:23, 17 November 2011 (UTC)
It's probably better to describe a daemon as a process that runs in the background and independent of a user's login session, if anything.
: true, i'll try to integrate that into the description.
"Not connected to a terminal" isn't quite it, a daemon could print to a tty all day if it wants to.
: yes, but only if it opens the tty manually. it should otherwise be able to run without a tty being present.
Also, why do you want a daemon process to both detach from stdout ''and'' print to stdout? Wouldn't it be saner to have it directly write to a file to begin with? --[[User:Ledrug|Ledrug]] 08:23, 17 November 2011 (UTC)
: i want it to detach from the stdout that is connected to the users terminal, and write to a file as if it were stdout. redirecting stdout is the sanest way to achieve that because the internals of the program and the libraries used can continue to write to what looks like stdout. if i open a file in the daemon itself, and use that i have to go out of my way to make sure that everywhere i have output the file is used. i have to make that file globally accessible or pass it around as a variable. there may be languages/situations where this is the better option, but i would not say that it is always better or saner.--[[User:EMBee|eMBee]] 08:56, 17 November 2011 (UTC)

Revision as of 08:56, 17 November 2011

Bad definition?

It's probably better to describe a daemon as a process that runs in the background and independent of a user's login session, if anything.

true, i'll try to integrate that into the description.

"Not connected to a terminal" isn't quite it, a daemon could print to a tty all day if it wants to.

yes, but only if it opens the tty manually. it should otherwise be able to run without a tty being present.

Also, why do you want a daemon process to both detach from stdout and print to stdout? Wouldn't it be saner to have it directly write to a file to begin with? --Ledrug 08:23, 17 November 2011 (UTC)

i want it to detach from the stdout that is connected to the users terminal, and write to a file as if it were stdout. redirecting stdout is the sanest way to achieve that because the internals of the program and the libraries used can continue to write to what looks like stdout. if i open a file in the daemon itself, and use that i have to go out of my way to make sure that everywhere i have output the file is used. i have to make that file globally accessible or pass it around as a variable. there may be languages/situations where this is the better option, but i would not say that it is always better or saner.--eMBee 08:56, 17 November 2011 (UTC)