Reputation: 43
On many of my servers autofs is hung and a process is trying to access a mount, and while I ssh to the remote host the it hangs there until I press Crtl+C from my keyboard
dew:~ # ssh dew00922
but when I press Crtl+C its goes to the prompt
dew:~ # ssh dew00922
^C-bash-3.2#
-bash-3.2#
I'm trying to send trap signal via the ssh but that also hangs
dew:~ # ssh dew00922 'trap 2 && service autofs restart'
Any help in fixing this issue.
Upvotes: 0
Views: 678
Reputation: 5372
timeout
is the tool made for such problems:
ssh dew00922 'timeout 2 service autofs restart'
See man timeout
for more information
Upvotes: 0
Reputation: 385660
When you ssh in, it's trying to run /etc/profile
and then ~root/.profile
(or ~root/.bash_profile
or ~root/.bash_login
) and ~root/.bashrc
. One of those scripts runs a command that is trying to access a hung filesystem. When you press ^ C, you're killing the script and getting a prompt from the bash on dew0922. At that point you are logged into dew00922 and can run commands. Any commands you run that try to access a hung filesystem will hang.
Upvotes: 2