Hey, I've been trying to do this also. Actually I'm just trying to use aliases to do some quick gameserver startup/exiting. I've got remote access to my dedicated server that is running CentOS, and I connect to it from my Windows client using PuTTY.
Currently I have these aliases:
alias bf2s='screen -S bf2screen;'
alias bf2run='cd /home/bf2user/gamecreate/bf2/; /bin/bash ./start.sh +dedicated +lowPriority'
alias bf2show='screen -r bf2screen'
And what I do to start up the server is:
- I type bf2s, which opens the blank screen.
- Inside the screen I type bf2run, which starts the gameserver inside the screen session.
- Then I do a Ctrl-A, Ctrl-D to leave the screen.
- If I ever want to view the status I type bf2show, and do another Ctrl-A, Ctrl-D to leave the screen again.
- To shutdown this gameserver I either have to kill the screen and server processes manually by their PID, or I have to type bf2show, and then type exit, to close the screen session containing the game server.
What I'd like to do is:
- Have an alias (or a script that could be called by an alias) that would start up the server inside a screen using only one command.
- Have an alias (or a script that could be called by an alias) that would shutdown the server and the screen using only one command.
I've tried a number of things including piping and using < and > to send commands to the screen from a single prompt with no luck.
Can anyone give me a clue here? I've taken a basic linux class and am taking an Admin and Install linux class this coming semester, but this is beyond my knowledge.
Many thanks for any help!