|01-27-2012, 05:54 AM||#1|
Join Date: Jan 2012
OSX Lion: Launchd VMware script stops unwanted
Hi all, I am new on the forum, but definitely not on OSX and Unix. Still i have an persistent issue.
I wrote a start script, in this case for VMware. Runs perfectly when hit from commandline: The script starts VMware, then the script exits and VMware keeps running.
Basically, this is the shell script, mark the backticks:
`/Applications/VMware\ Fusion.app/Contents/Library/vmware-vmx -x /Users/pietje/Virtual\ Machines/Ubuntu\ 64-bit.vmwarevm/Ubuntu\ 64-bit.vmx >> $logFile 2>&1 &`
The following script will make Launchd start VMWARE, and also keep it running, but now the bash script will remain running.
`/Applications/VMware\ Fusion.app/Contents/Library/vmware-vmx -x /Users/pietje/Virtual\ Machines/Ubuntu\ 64-bit.vmwarevm/Ubuntu\ 64-bit.vmx & >> $logFile 2>&1`
But when calling with launchdaemon, the script runs, starts VMware. When the bash script ends however, VMware gets terminated too.
Here is my plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
I have tried all kinds of stuff. also nohup, but that will not work too, gives
nohup: can't detach from console: Inappropriate ioctl for device
Also <key>KeepAlive</key> <true/> does not work
Any guru here who can help me?
|01-27-2012, 01:27 PM||#3|
Hall of Famer
Join Date: Apr 2002
This may be one of those cases where it's better to employ launchd directly, instead of having it call upon a script. E.g. this should work:
: : <key>ProgramArguments</key> <array> <string>/Applications/VMware Fusion.app/Contents/Library/vmware-vmx</string> <string>-x</string> <string>/Users/pietje/Virtual Machines/Ubuntu 64-bit.vmwarevm/Ubuntu 64-bit.vmx</string> </array> : :
NB: as can be seen in my (code fragment) version, we should not escape\ spaces or add any "quoting" in the plist... since those <string> fields get quoted when read by launchd.
NB2: since we aren't relying on any script process to act as our middleman, there's no need for that backgrounding (&) business.
Also, I left out the >> $logFile 2>&1 part... since we don't know the actual path there.
chown -R us /your\ base/
Last edited by Hal Itosis; 01-27-2012 at 01:31 PM.
|01-30-2012, 06:23 AM||#4|
Join Date: Jan 2012
Without bakticks teh script does not run well.
@ Hal Itosis: your posting seems the best hint so far, got it also from a friend of mine. Thanks especially for the remarks (the two NB's) because I am sure those will save me two or more hours! :-)
I keep u posted on the results.
|launchd bash vmware lion|
|Display Modes||Rate This Thread|