Shell Command

Hi all,

I am runnning a small app. It executes a command in the underlying OS using "Shell()". Can any one tellme  by default which shell is used on Unix environment.

Also i have another question.
This is on Replication or Save conflict. How to eradicate them or solve them on Web.

TIA
Kalyan
kalyankondurieAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
I assume the shell as defined by/for the user "notes".

Handling Rep/Save conflicts is best done manually, in Notes. There is a simple tool in the Sandbox that can compare 2 documents, so you can see the differences easily. You need that to find out how to adapt fields in the original document so you can remove the conflict document.
0
qwaleteeCommented:
Hi kalyankondurie,

As far as I know no shell is used to launch a program in Unix.  The OS opens it directly.

Best regards,
qwaletee
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

qwaleteeCommented:
Avoiding conflicts on the web --
1) If you have multiple servers, cluster them
2) If you can employ document locking of some sort (single server or multiple servers), do that.
3) Avoid unnecessary saves
4) Try to keep user sessions short.  You can use the JS timoueout to pop up a box every X minutes that asks the user to confirm s/he is still active, and if they do not respond to the box, another timeout function closes the box AND teh document (and even perhaps logs teh user off)
0
RanjeetRainCommented:
>> Can any one tellme  by default which shell is used on Unix environment

It doens't use any of the shells. It directly calls the system() API call (referred to as system call under Unix).


>> This is on Replication or Save conflict. How to eradicate them or solve them on Web.

To remove conflict from a document, delete teh field $Conflict.

To avoid conflict situation, follow as Qwalette's post suggests.
0
Sjef BosmanGroupware ConsultantCommented:
Unix has no system-call called system(). system() is a library-function(3) that calls fork and exec system calls. Even worse, 'man system' will tell you that system will call... /bin/sh ! On Linux, that is. I don't expect Unix to be completely different.

I think I misunderstood Kalyan completely. You wanted to prevent Rep/Save conflicts, not solve them? Go with Qwaletee. Deleting the field $Conflict will stop the document from being displayed as a conflict in the view, but then you will have two documents when you want just one. It is better to find the differences, merge the two documents and delete the conflicting one.
0
RanjeetRainCommented:
kalyankondurie,

Its been many years since i lastly programmed for Unix and I misplaced something. system() is a C library function and NOT a Unix System call. There is no shell() on Unix. You must be talking about some user-defined function. Generally programmers call system and it pretty much takes care of everything. That's the concept of SHELL on Unix.

I reckon you are concerned about the environment as you may need to access certain variables. For that you don't need to lose sleep over which shell is used. fork()/exec() etc are lower level calls. They do not use shell. If you want to use the environmental variables, you can use the existing Environmental block that is available to each process running on Unix. You have to pass a third argument to main() to access the same. This third argument is generally called envp (pointer to environment).

My advice for you is: If you want to do simple shelling, forget everythign and use system(). If knowing about the environment is critical for your program, pass the third parameter to main() and call fork()/exec(). Be warned that fork() creates a child process whereas exec() replaces the current process. So, going by the general understanding of SHELLing, you will have to make two calls, fork() follwoed by an exec() or its variant.
0
Sjef BosmanGroupware ConsultantCommented:
The Unix function system() is comparable to the Shell() function in LotusScript. So much is true. The rest needs some explanation and polishing up, that had better be done in the Unix TA. I think we're diverting too much from the original question(s).

I created an agent
    Dim i
    i= Shell("/bin/sleep 100")

You can find the process and its parent with
    ps -ef | fgrep sleep
and the same way you can find the parent: amgr. There is no Unix-shell in between. So if you need a (particular) shell, use
    i= Shell({/bin/ksh -c "sleep 100"})
and verify whether the shell is running. Shell command files can be started this way.
0
qwaleteeCommented:
Sjef, and Ranjeet, we're al saying the same basic thing -- LotusScript, when interpreting its Shell command under Unix, does not call a system shell to execute the program, it just fork's it, which is a straight OS-with-no-shell call.  The hoarier details are best left out of it, as they irrelevant.

In other words, the answer to the question is: NONE.
0
Sjef BosmanGroupware ConsultantCommented:
Indeed. It's a pity though that the name of the function is rather confusing.
0
RanjeetRainCommented:
THat's what my response was. >> It doens't use any of the shells. << Rest of it was clarification/elaboration etc.
0
kalyankondurieAuthor Commented:
Hi Ranjeet, bosman, qwalette,

 First of all thanx for ur replies and sorry for lately replying ur posts.

I have changed the default shell at "/etc/passwd" of solaris 8(our test server) to "/bin/bash"
and executed the app again. It's running the "ls" command in "sh" envi and not in "bash". So Domino is using sh by default. I want to write the stderr to a file in this and retreive that as well.
i tried "Shell(ls > strFile.txt 2&<1)" but no luck so far. Any suggestion on this.


Kalyan
0
Sjef BosmanGroupware ConsultantCommented:
Did you read all of the above? Domino doesn't start a shell, as far as we can tell.

To do what you want, you'd better create a shell-file that contains
     ls > strFile.txt 2>&1
and start it using
     Shell("/bin/bash -c /local/something/shellfile")
0
moduloCommented:
PAQed with no points refunded (of 100)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.