[19:12] <you-tee-f> how can i change the default run level ?
[19:15] <jY> start on runlevel [2345]
[19:15] <jY> ?
[19:35] <SpamapS> /etc/init/rc-sysinit.conf, btw, if he comes back
[23:04] <herriojr> hello
[23:04] <herriojr> I'm having a hard time following documentation on how to handle this scenario:
[23:05] <herriojr> I have a daemon which can be started and stopped by calling "daemon start" and "daemon stop" respectively
[23:06] <herriojr> now, initctl will send out the sigterm signal itself, but the daemon catches the sigterm and waits until it is actually safe to shut down, so it can take X amount of time
[23:08] <SpamapS> herriojr: initctl does not send any signals
[23:08] <SpamapS> herriojr: it tells upstart to send them from pid 1
[23:09] <SpamapS> herriojr: if you have an expected lag for your kill signal, you can use 'kill timeout'. man 5 init shows that.
[23:09] <herriojr> yes, ok, so is it safe to put the "daemon stop" in pre-stop to force it to wait (daemon stop will wait until the daemon has exited before returning)
[23:09] <herriojr> SpamapS: the issue is due to the nature of the daemon, it's safe point is undetermined
[23:10] <SpamapS> herriojr: you mean due to the fact that it doesn't handle SIGTERM properly by shutting down gracefully?
[23:10] <herriojr> SpamapS: yes, and I didn't write the daemon, so I'm having to work around it
[23:10] <SpamapS> herriojr: or due to the fact that upstart doesn't know its pid, because you need to use pre-stop and post-start to send the 'daemon start' and 'daemon stop' commands?
[23:11] <herriojr> so it's written like: do some undetermined amount of work; check if sigterm was sent and if so, exit
[23:11] <SpamapS> herriojr: upstart does not have to track a daemon's pid. You can defer that to those programs by using post-stop (don't use pre-stop) and post-start to run the stop/start commands.
[23:12] <herriojr> would that mess up a restart?  meaning, restart sends a stop followed by a start and if it wasn't stopped in time, this daemon could get screwed up
[23:13] <SpamapS> restart is 100% broken and does not run pre-stops actually
[23:13] <herriojr> ok
[23:13] <SpamapS> (thats why I say, don't use pre-stop)
[23:13] <herriojr> great to know
[23:13] <herriojr> haha ok
[23:13] <herriojr> ty6
[23:13] <herriojr> ty
[23:13] <SpamapS> but I would actually avoid restart if you can
[23:13] <herriojr> I think that might be enough information for me to try some things out
[23:13] <herriojr> thanks
[23:13] <herriojr> kk
[23:14] <SpamapS> if you use the 'service' command, it does stop/start
[23:15] <herriojr> ok thanks