Hi,
oppentrapp from norway wrote:
i dont have a stop_server.command π
To stop the server, you must type 'stop' into the Terminal window.
Closing the Terminal window without stopping the server could lead to corruption of the save files.
Here is the complete script.
-----------------------------------
onrun
set myCommand to "cd '/Users/jack/minecraft' && java -Xmx3G -Xms3G -jar craftbukkit.jar"
set r to display dialog "Start or stop the bukkit server ?" buttons {"Stop", "Start"}
set serverRunning to do shell script "/bin/ps -ax | /usr/bin/grep ' craftbukkit.jar' | /usr/bin/grep -v 'grep' || true"
ifbutton returnedofris "Start" andserverRunningis "" then -- the server is not running.
tell application "Terminal"
if running or not (exists window 1) then
do script myCommand
else
do script myCommand in tab 1 of window 1
end if
end tell
else if button returned of r is "Stop" and serverRunning is not "" then -- server run
tell application "Terminal"
set tTab to ""
repeat with this_wind in (get windows)
try
set tTab to (first tab of this_wind whose its contents contains "-jar craftbukkit.jar")
end try
end repeat
if tTab is not "" then -- found tab
do script "stop" in tTab
repeat while "java" is in (get processes of tTab) -- loop until the server is stopped.
delay 2
end repeat
if (countwindows) is 1 and (counttabsofwindow 1) is 1 thenquit -- no others processes, quit the Terminal
end if
end tell
end if
endrun
-----------------------------------
Replace this text in the second line : /Users/jack/minecraft by the path of your "minecraft" folder