Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AIX Kill help

Status
Not open for further replies.

BJZeak

Programmer
May 3, 2008
230
CA
I remotely connect to an AIX machine to update files on a regular basis however every once in a while I loose a connection without AIX dropping the session. If I login the session is still active ... at this point I have a huge amount of work that I was going to save but was interrupted by a phone call. If I terminate this session with a kill -9 it will die without creating a recovery file.

So my question: is there any way to kill the process so it generates a recovery file? Normally if a session terminates AIX drops the session creates a recovery file and emails my user account. As long as the session remains open the file is in limbo and nothing is saved (as far as I know). Perhaps there is a temp file located somewhere for VI?
 
So, use [tt]kill -1[/tt] (Hangup) or [tt]kill -6[/tt] (Abort).
A [tt]kill -9[/tt] is immediate, vi cannot respond to that signal. Don't use [tt]kill -9[/tt] unless that is your only option left!

Next, [tt]ex -r[/tt] will show your preserved file(s)
[tt]ex -r filename[tt] will recover your editing session. Don't forget to save your file!

HTH,

p5wizard
 
Thanx I will have to try that next time this happens ... this time I just patiently waited for the nightly Cron spawned backup which gracefully disconnects all users and it thankfully created the recovery file I needed so didn't loose my work after all. The old saying of "SAVE OFTEN" is also kicking me. Sigh!

I have a script that takes down all of my sessions/processes in one go which I use especially when there is a network connection failure like this:

UserName=MyAIXUserName
rusure=N

for CurrentUser in `whoami`; do
echo " "
done

if [ "$UserName" = "$CurrentUser" ]
then
read rusure?'Are you sure you want to exit all sessions?(y/n)'
if [ "$rusure" = "Y" ] || [ "$rusure" = "y" ]
then
echo Exiting all Sessions for $UserName
sleep 1
nohup kill -9 -1 > /dev/null
fi
else
echo --- Exit all Sessions is not valid for $CurrentUser
fi

but because, as you confirmed, -9 doesn't allow VI the chance to do anything this script destroys my files

If I recall correctly -1 signals to stop all processes that are owned by the $CurrentUser

so I will try a modifed script with just kill -1 instead of kill -9 -1 and see if that works.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top