LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-15-2012, 04:04 PM   #1
SkM007
LQ Newbie
 
Registered: Jun 2011
Distribution: Oracle, BackTrack
Posts: 28

Rep: Reputation: Disabled
Smile How to access an ongoing process (initiated thru remote access)


Hello frnds...

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...

Last edited by SkM007; 05-15-2012 at 04:08 PM. Reason: language
 
Old 05-15-2012, 06:49 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,309

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
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
Code:
sudo yum -y update
 
Old 05-15-2012, 07:10 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681Reputation: 681
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)

Last edited by jschiwal; 05-16-2012 at 01:54 AM.
 
Old 05-16-2012, 06:22 AM   #4
jgbreezer
LQ Newbie
 
Registered: Mar 2011
Location: London, UK
Distribution: Ubuntu + Redhat(work)
Posts: 7

Rep: Reputation: 0
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).
 
Old 05-16-2012, 04:36 PM   #5
SkM007
LQ Newbie
 
Registered: Jun 2011
Distribution: Oracle, BackTrack
Posts: 28

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply

Tags
freeze, kill, process, putty, remote session


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Disable remote root access but allow local root access-- possible? bskrakes Linux - Security 4 02-21-2019 04:02 PM
how to monitor a running script initiated from remote computer babag Programming 3 04-07-2008 03:11 PM
Process=idle --last access knockout_artist Linux - Newbie 1 11-09-2007 05:53 PM
a lot of http process initiated by the server itself??.. jaggy00 Linux - Server 2 06-29-2007 04:57 AM
access to context of a process swaroopjoshi Linux - Kernel 5 11-24-2006 12:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration