Red Hat Bugzilla – Bug 1308450
Allow parent processes to terminate graciously after calling shutdown -r now/reboot/init 6
Last modified: 2016-02-15 08:08:56 EST
Description of problem:
When calling shutdown -r/reboot/init 6 parent process should be allowed to terminate graciously like on RHEL6 where systemd is not used.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. execute bash script with following content (as root):
shutdown -r now
2. ls /root/test
3. file /root/test does not exist
4. shutdown -r now can be replaced with either reboot or init 6, behavior is not changed
File /root/test does not exist as parent process is not allowed to terminate graciously.
File /root/test should exist like it does when executed on RHEL 6.7 machine (it gets created on RHEL 6.7 in all 3 cases).
This behavior is root cause of following bug: https://bugzilla.redhat.com/show_bug.cgi?id=1260527
Well, your reproducer should not work anywhere because:
1) Init will send you sigterm immediately which will kill your script.
2) Termination of login process will end up with sighup, which will kill your script.
If you try to block those signals:
[root@localhost ~]# cat test.sh
logger "XXXXX-my pid: $$"
trap "echo nope" SIGTERM SIGINT
echo whoohooo > /root/out
[root@localhost ~]# nohup ./test.sh
The /root/out will be created. I guess it worked for you on rhel6 only because the shutdown was pretty slow there.
*** Bug 1274433 has been marked as a duplicate of this bug. ***