Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[todo] daemonize 'enable' #35

Closed
ahmetb opened this issue Jul 26, 2016 · 1 comment
Closed

[todo] daemonize 'enable' #35

ahmetb opened this issue Jul 26, 2016 · 1 comment

Comments

@ahmetb
Copy link
Contributor

ahmetb commented Jul 26, 2016

I am planning to write a bash script shim that

  1. deamonizes the enable command
  2. redirects the logs of enable command to a static location e.g. /var/log/azure/custom-script/handler.log

an example of this is here: https://github.com/Azure/azure-docker-extension/blob/master/scripts/run-in-background.sh

in this case, cmds like install/enable/disable/uninstall wouldn't be logging to this path, but I think we should write a shim for those as well (that doesn't daemonize).

I want this shim because waagent does not collect child processes (e.g. extensions) logs from their stdout/stderr and expects them to write to a LogFolder specified in HandlerEnvironment.json.

This is quite against the unix philosophy (processes logging themselves to the files) and it's also not reliable as the go process panics, it won't be able to log the panic. But if we have a shim (written in bash script) we can collect the crash logs as well into a file with a simple .. | tee -a redirection.

@boumenot what do you think?

@ahmetb
Copy link
Contributor Author

ahmetb commented Jul 26, 2016

we could theoretically keep the daemonizing inside the enable() code and the shim would just redirect the logs... however, golang has issues with daemonizing. golang/go#227 there are libraries to address: https://github.com/sevlyar/go-daemon but this solution seems like an overkill where we could just use 2 lines of bash script to double-exec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant