Unix scripting help

Sarah Reichelt sarah.reichelt at gmail.com
Thu Sep 29 16:41:20 EDT 2005


> 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



More information about the use-livecode mailing list