How to access an ongoing process (initiated thru remote access)
I got a question (a problem also)... i was accessing oracle linux (in VM workstation) thru ssh (putty)... i downloaded new repo & then did this "yum update". now it started downloading lot of stuff & then somewhere in the middle it asked for my input (some question where i had to press y/n) & when i tried to enter 'y' i came to know that putty was disconnected & the program is halted.
then i directly went into the o/s & again i tried to start the same process from zero but when i gave command "yum update", i got error
yum is locked/sleeping coz of some process & process id is 3019
something like that... so what i did is i killed the process & started it again...
Now, after all this story (& thanks for being so patience), i wanna ask a question 'is it possible to start the same process (ID 3019) as it was struck coz it was waiting for my input (remember y/n). it would be better instead of killing it & starting a new process & how would i do that?'
thanks in advance... :)
you mite be able to use fg or bg to manipulate a running program. it is hard to automate a program which requires human intervention (quite the parodox). the hack would be to use expect. the correct way would be to use programs that dont require a human to baby-sit it. for example your yum example could be called like
When you disconnected, you sent an HUP signal to the process, terminating it.
Check if that process still exists. It may be an orphaned PID file that needs to be deleted in /var/run/. Another instance of yum won't start if an old pid file for yum exists. It could also be a background process you invoked indirectly such as kpackage manager. If the is the case, it could be restarted.
Use "ps -f 3119" to print out the command line of the blocking program.
In the future, consider using screen. You can press 'CTRL-a d' to disconnect and then even log out.
For y/n prompts you can use the form: "command < <(yes y)" to answer the prompt positively.
I usually use it in the negative to prevent overwriting file:
mv -i file file2 ... dest/ < <(yes n)
Screen is indeed great for this; also tmux does a similar job and is slightly more up to date in some areas and uses less resources (but not as mature or does as much).
I am in the habit now of using one of these tools just about every time I open a new terminal at work, that way if my terminal/connection dies (not that it does usually) I can easily continue longer tasks just by reconnecting to the same session again. Almost like having multiple virtual desktops in some ways as you can switch between multiple sessions too and have them notify you on activity with a bell or highlighting their title in the title bar (a screen/tmux status bar inside the terminal display).
thank you everyone for ur valuable time & knowledge... i'll definitely try screen & tmux, to see which one i'll get synced with... in future i'll try the redirections & yum -y thing to avoid these issues...
once again, thanx for helping me :)
|All times are GMT -5. The time now is 09:26 PM.|