I have a server written in Node.js listening to SIGTERM and SIGINT events. I'm wondering id the Ubuntu stops all PIDs (or which PIDs) it stops before restarting. So for example if my node process listens to those events and wants to gracefully shutdown but gracefully shutting down will take awhile how long do I have before the OS force kills it.
Does the OS stop all PIDs before restarted when the user clicks restart in Ubuntu
Ubuntu
Related Topic
- Ubuntu – restart apache under www-data user in ubuntu
- Ubuntu – the preferred method to restart networking in Ubuntu and Debian
- Ubuntu – How to start/stop/restart ApacheDS 1.5.7 on Ubuntu 11.04
- Linux – When does an upgrade update the Ubuntu kernel
- Linux – validate all the files before copying to all the remote servers
Best Answer
If you choose to shutdown or reboot the system, then systemd will send your process a SIGTERM signal first. If it doesn't react to SIGTERM within a certain amount of time, it will send SIGINT, and if it still doesn't respond to that it will eventually send SIGKILL. I believe the times are 90 seconds and 5 minutes respectively, but I can't find the relevant docs, it's been quite a while since I profiled shutdown, and I don't want to profile shutdown again right now...