3 ms·
That was my first idea too, slightly hindered by the fact I couldn't remember where it actually stored that on the fs. Second idea was `sudo reboot now`
by voidUpdate 2y ago
That was my first idea too, slightly hindered by the fact I couldn't remember where it actually stored that on the fs.
Second idea was `sudo reboot now`
- pxx 2y agosudo forks at least once (bash spawns /usr/bin/sudo), but also will fork to execute the command if logging is enabled (see the manual page for sudo(8)). you can `exec sudo` but this will hose you if it tries to fork (because now you've lost your bash).
- voidUpdate 2y agossh back in as root then `restart now`
- kelnos 2y agoIf you're out of pids, you can't ssh back in (though this raises the question of how you ssh'd in in the first place). And hopefully you have root ssh logins disabled. But I think a prerequisite is that you already have a root shell; some systems don't allow accessing all of /proc unless you're root, and if you figure out what process is exhausting all your pids and want to kill it, you probably need to be root to do that, unless you're very lucky and that process happens to be running under your regular user account. At any rate, you'd need to `exec restart now`, because just `restart now` would try to fork. (Also, there's no `restart` command; I think you meant `reboot`, and it doesn't need arguments. `shutdown -r now` would also do it.)
- voidUpdate 2y agoWould exiting the ssh session not free up the pid again? Also yes, I meant `reboot` not `restart`, and I always forget its only shutdown that needs the `now`, not reboot
- pxx 2y agonot if something is gobbling up PIDs. that's literally the hypothetical, which you have completely ignored