go-daemon
go-daemon copied to clipboard
PID and Log files should respect workdir paths
Currently, placing the pid
and log
files anywhere other than the current directory requires hardcoding the absolute paths into the name
for each one. This is highly inflexible, and certainly not platform agnostic. I suggest a slight fix to allow the workdir
to be included in the paths. A better fix might be to have a separate path
for each one.
Daemon doesn't have current directory (workdir) in general sense because it uses several global directories to ensure its work. By Filesystem Hierarchy Standard (FHS) pid-files should be placed in /var/run
directory, log-files in /var/log
, configuration in /etc
. Additionally, there can be OS-specific differences and various functional-specific cases, e.g: you need an one log file or you need a directory to log file rotation and etc. So that using of workdir for a daemon doesn't have the sense in most cases.
go-daemon doesn't aim to be framework and i don't know how to implement flexible functional for all cases, so that i leave it out for client code.
@sevlyar I agree they should default to that sensible output location, but currently it just dumps them where the command is being run from, which is less than ideal. I would take your solution over a workdir
, but the current behavior doesn't do either.