Operating System - HP-UX
1753943 Members
9274 Online
108811 Solutions
New Discussion юеВ

Anamolous behaviour with multiple sessions.

 
Purusa
Frequent Advisor

Anamolous behaviour with multiple sessions.

When I open different sessions in the same directory path, I get different behaviour while deleting the directories.
The problem is like this:
I log in one path: /abc/xyz/kkk
Then I try to uninstall all the software present in the workstation including the parent directory itself i.e. /abc/xyz/kkk.I have code whereby I detect presence of this directory path and pop-up messages corresponding to presence or absence of this directory path.
In case only a single user is logged on the in this path(i.e user who is uninstalling the software), behaviour is ok. But in case of two or more users logged in the same path the behaviour is not as expected.The directory structure gets deleted in all the test cases.
Can someone give some explanation of this behaviour.

Thanx in advance,
Regards,
Pankaj
A deep chasm can't be crossed in two steps
15 REPLIES 15
Elmar P. Kolkman
Honored Contributor

Re: Anamolous behaviour with multiple sessions.

I'm not sure I understand... If multiple users are logged in, what happens and what would you expect???
Every problem has at least one solution. Only some solutions are harder to find.
Todd McDaniel_1
Honored Contributor

Re: Anamolous behaviour with multiple sessions.

I think you are asking this:

Why even though a second user can cd /abc/xyz/kkk and you can still remove the software and the directory while someone is in the directory?


___________________________
I think the behavior you are looking for is that the uninstall process would fail to uninstall and also fail to remove the directory b/c of the user in the named directory.


The action you are expecting I think is similar to the umount command where the filesystem is busy. OS functions are smart in HPUX, so as dis-allow you to umount a filesystem in use or where a user is active in it. I dont think the swinstall function allows for a check to see if anyone may be in a directory.

I dont think this is the same as the umount command. Removing software has no such checks to see who or what id is active in a certain directory.

However, with that said, I would expect some complaint that a user is active or something similar.

What happens to the user? Are they disconnected or merely dropped to a lower lvl directory?

Hope this helps.
Unix, the other white meat.
Michael Schulte zur Sur
Honored Contributor

Re: Anamolous behaviour with multiple sessions.

Hi,

But in case of two or more users logged in the same path the behaviour is not as expected

That means? Are you using rm to uninstall the software, or how do you do it?

greetings,

Michael
Purusa
Frequent Advisor

Re: Anamolous behaviour with multiple sessions.

Hi all,

Thanx for the prompt answers/suggestions provided.
I am using "rm" to uninstall the software.
In all the scenarios the parent directory from where I run the script gets deleted.

I have a piece of code which is like this:
if [ ! -d /abc/xyz/kkk ];
then
"pop-up error msg"

So when two users are logged in the same directory path, although directory structure has been deleted still this message is being displayed.
With single user logged in and uninstalling the software, the behaviour is ok i.e. this error message is not popped up. I hope the problem is clear now.
A deep chasm can't be crossed in two steps
Massimo Bianchi
Honored Contributor

Re: Anamolous behaviour with multiple sessions.

Th problem lies in the logic of the script, is not meant to be multi user.

If multiple users should be able to use it, you must ensure that everything id not duplicated, including directory names.

For example, you can use that directory as a base, but each process MUST use a unique subdirectory, choosen at runtime.

I suggest you to create some code with the $$ buil in variable, that is the PID number, unique as sufciente.

[-d /yourdir ] && "mkdir /yourdir/workset_$$"


And then install from the workset_$$

Massimo
Purusa
Frequent Advisor

Re: Anamolous behaviour with multiple sessions.

Hi Massimo,

I understand that the script is not meant for multi users but I wanted to know the root cause of the problem.
Why is there anamolous behaviour? Is it something internal to Unix or what???

Regards,
Pankaj
A deep chasm can't be crossed in two steps
Michael Schulte zur Sur
Honored Contributor

Re: Anamolous behaviour with multiple sessions.

Hi,

I have a piece of code which is like this:
if [ ! -d /abc/xyz/kkk ];
then
"pop-up error msg"

So when two users are logged in the same directory path, although directory structure has been deleted still this message is being displayed.

After you've deleted the directory structure, the message should pop up, because it does not exist anymore. There is however an inconsistency in some shells, which allow you to delete a dir, which is your current one. The best way to avoid this, is of course to run it from somewhere else.

can you check, what I said?

Michael
John Carr_2
Honored Contributor

Re: Anamolous behaviour with multiple sessions.

Hi

try using fuser command to see if anything is attached to the directory before using the rm command.

fuser -c /dir_to_delete

:-) John.
Purusa
Frequent Advisor

Re: Anamolous behaviour with multiple sessions.

Hi Michael,

While deleting the directory structure, I first go to root / directory and delete the directories.
But the main problem is that the piece of code
if [ ! -d /abc/xyz/kk ]; then
"pop up error msg"

does NOT pop up error msg with single user logged on and uninstalling the software.
However, the same piece of code POPS UP error msg with two users logged on.

The behaviour shd be consistent i.e. error msg in both the scenarios or no error msg in both the scenarios.

Regards and Thanx,
Pankaj.
A deep chasm can't be crossed in two steps