Unix scripting help
Chris Sheffield
revlist at cableone.net
Tue Oct 4 12:17:30 EDT 2005
Sarah,
Thank you for this. I think I'm getting closer using your little
trick, but my standalone still hangs at that point. I've tried it
with "exit" and without with the same results. I just don't get why
this is happening. When I create a script file and run it from
Terminal, it works as expected. When I run the script from within
Rev it hangs. Do you (or anyone for that matter) have any other ideas?
Thanks.
On Sep 29, 2005, at 2:41 PM, Sarah Reichelt wrote:
>> 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
>>
>
> Hi Chris,
>
> Here is an example of a script I use that really does run in the
> background.
>
> put "ping -c1 -n " & pIP into tShellCmd
> put " > " & tFileName & " 2>&1 &" after tShellCmd
> get shell(tShellCmd)
>
> I tried using the ampersand and it didn't work but this does. It
> writes it's output to a file which you may not need, but the crucial
> bit is the " 2>&1 &" which allows my Rev script to continue without
> waiting for the shell command to finish.
>
> You can feed your lines into the variable "tShellCommand" although you
> may not need the "exit" at all.
>
> I hope this helps as I detest installers that require me to do a
> reboot. I feel it is nearly always due to lack of understanding or
> programmer laziness rather than because the system really needs to
> restart.
>
> Cheers,
> Sarah
> _______________________________________________
> 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
>
------------------------------------------
Chris Sheffield
Read Naturally
The Fluency Company
http://www.readnaturally.com
------------------------------------------
More information about the use-livecode
mailing list