My VBox CentOS 7 image with some custom software has a problem that it shuts down too long. I'd like to find the culprit by running shell commands from the console, but all shells are being killed.

I tried to protect the bash process with the "at"-sign (@) and ignore HUP, but it's apparently not enough.

# cat /tmp/dontkillme.rc
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
trap '' HUP

# TERM=linux setsid bash -c 'exec -a "@dontkillme" /bin/bash --rcfile /tmp/dontkillme.rc -i <>/dev/tty8 >&0 2>&1'

# poweroff

This enables bash on tty8 for some time, but in the end it's being killed too, but the image stays powered on

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.