Unix scripting help

Andre Garzia soapdog at mac.com
Thu Sep 29 12:58:29 EDT 2005


Hi Again Chris,

as I said, reading further into the Bash Scripting Guide, under the  
special chars section I discovered that using ampersand to run  
something in the background can cause a script to hang waiting for a  
keypress. The solution is to place a wait command after the  
background command. Be aware that they say that this ampersand hangs  
usually happens with process that should write to stdout, I don't  
know if your process is outputting something but anyway, more info is  
always welcome...

I saw this fix at http://www.tldp.org/LDP/abs/html/x6618.html#WAITHANG
The & part is at http://www.tldp.org/LDP/abs/html/special-chars.html

So I guess your script would become:

#!/bin/bash
pw=[PasswordHere]
echo $pw | sudo -S /Library/RNSEServer/RNSEServer &
wait
exit 0

cheers
andre

PS: Bash scripting can do miracles!!!!

On Sep 29, 2005, at 1:46 PM, Andre Garzia wrote:

> Hello Chris,
>
> First of all, I recommend taking a look at http://www.tldp.org/LDP/ 
> abs/html/ which is the Advanced Bash Scripting Guide. A very good  
> reading.
>
> There's a chapter under basic called exit and exit status which I  
> think will cover what you need, if all you need is a return value  
> for your script then use "exit 0" for zero is the default OK for unix.
>
> I'll further check the guide to see if the background command  
> you're using (&) can be called from scripts, if I discover  
> something new, I'll send a new email to the list, in the mean time  
> if exit 0 works, drop me a note. :D
>
> Cheers
> andre
>
>
>
> On Sep 29, 2005, at 1:14 PM, Chris Sheffield wrote:
>
>
>> I can't get this to go through for some reason.  So here it is again.
>>
>>
>> I hope I'm not totally off topic here.
>>
>> I've got an installer in Rev that has to start a process under OS  
>> X using the shell function.  I'm able to get the process to start  
>> just fine using a command line script.  But the problem I'm having  
>> is this particular process does not return any value when started,  
>> and the shell command is not exiting because of this (at least  
>> that's what I assume is happening).  So my script just kind of  
>> hangs at that point.  The process I'm starting is the Valentina  
>> database server.
>>
>> So what I'm looking for is a way to run my script, which starts  
>> the process, but include in my script something that says, "Okay,  
>> I'm finished now", and will allow my handler to go on at that  
>> point.  This is the current script I'm running with the shell  
>> function:
>>
>> #!/bin/sh
>> pw=[PasswordHere]  -- this is obtained earlier with an  
>> authentication dialog
>> echo $pw | sudo -S /Library/RNSEServer/RNSEServer &
>> exit
>>
>>
>> Now, if I run these lines one at a time from a Terminal window  
>> everything works great.  But if I run the script all at once,  
>> whether from Revolution or from a Unix script file, it hangs,  
>> almost as if the exit command isn't executing.  So is there  
>> something I can use in place of 'exit' that will cause my script  
>> to finish?  Or is there same way to cause the shell function not  
>> to wait like it does by default?  I was previously using "open  
>> process" instead of shell, and that worked except that it would  
>> launch the process as the user who was logged into the computer  
>> rather than as the root user, and I need it to run as root.
>>
>> Any help would be appreciated.
>>
>> Thanks,
>> Chris
>>
>> ------------------------------------------
>> Chris Sheffield
>> Read Naturally
>> The Fluency Company
>> http://www.readnaturally.com
>> ------------------------------------------
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list