I have a local script that runs a remote script via ssh. The local script is minecraft.php:
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {$this->pemkey} {$this->ssh_user} sudo /vol/start_bukkit.sh The remote script is /vol/start_bukkit.sh:
#!/bin/bash cd "/vol/bukkit" /usr/bin/screen -S bukkit -m -d /usr/local/bin/java -Xnoclassgc -Xms1024M -Xmx1024M -jar /vol/bukkit/craftbukkit.jar nogui What happens is that the java command works, launching craftbukkit.jar, but screen doesn't launch a new window. What's going on? How can a new window be created?
If I sign in to the remote server and run start_bukkit.sh then screen works as expected, creating a newly detached window running craftbukkit.jar in it.
EDIT:
I got it to work. I updated the local script by removing the sudo and putting the screen command in. Here it is:
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {$this->pemkey} {$this->ssh_user} /usr/bin/screen -S bukkit -m -d /vol/start_bukkit.sh On the remote side I removed the screen command:
#!/bin/bash cd "/vol/bukkit" /usr/local/bin/java -Xnoclassgc -Xms1024M -Xmx1024M -jar /vol/bukkit/craftbukkit.jar nogui I can't explain why this works.