Modeling the flow of the daemon
fxfactorial opened this issue · comments
Great package, thank you.
I was wondering about the flow of the daemonization, hoping to see if my thought process is accurate.
Going off of: https://github.com/takama/daemon/blob/master/examples/cron/cron_job.go#L50
Is the idea then that:
- call
service.Install
only once needed - call
service.Start
, this causes the usual daemonization double fork which creates its own instance but this time calling itself without a flag and hence going into the Cron working ?
Not entirely clear about 2
because I'm using cobra as a wrapper, so will that work nicely with the command line flags, arguments used by the double fork? Or should I expliclty control the commands used?
Example, I want to have it be: h-watchdog service start
where I'm grouping all the daemon related commands under service subcommand.
Nvm, figured it out. Key was to understand the passing of params to .Install
and using systemctl list-unit-files
and systemctl show -p FragmentPath <SERVICE_NAME>
to see the generated file.