I was wondering if it is possible for an applescript application to run a shell script and then exit before the shell script completes. This would be useful when starting the server for a certain amount of time. Instead of constantly running in the background, is there a way to run the function independently?
set server_name to text returned of (display dialog "Choose server." default answer "") set success to do shell script "if [ -f \"/Users/jessefrohlich/Documents/Minecraft/" & server_name & "/minecraft_server.jar\" ]; then echo 1; else echo 0; fi" if success is equal to "1" then do shell script "cd /Users/jessefrohlich/Documents/Minecraft/" & server_name & " java -Xmx1024M -Xms1024M -jar minecraft_server.jar" else display dialog "Sorry, the file you chose is invalid." end if
When the above is executed as an application, it will start the server properly. However, runScript.app will continue to work. The server will continue to work even if applescript is a forced shutdown. Is there a way for it to automatically stop as soon as the server starts up?
thanks
source share