Skip to content

Commit bde6d15

Browse files
author
CharmySoft
committed
Add a bash script to set up the server
1 parent 8c8faa5 commit bde6d15

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

docs/MANUAL-SERVER.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
Manual for Tic-Tac-Toe Server
22
========================
3-
To start the server, run ttt_server.py with
3+
To set up the server, you can run the following shell commands.
4+
```bash
5+
# Change this to your desired path
6+
TTT_SERVER_SCRIPT_PATH="/ttt_server.py"
47

5-
ttt_server.py [port_number]
8+
# Download the server script to your specified destination
9+
sudo wget -O $TTT_SERVER_SCRIPT_PATH http://github.com/CharmySoft/tic-tac-toe-in-python/raw/master/ttt_server.py
10+
11+
# Download the upstart configuration script
12+
sudo wget -O /etc/init/ttt-service.conf http://github.com/CharmySoft/tic-tac-toe-in-python/raw/master/ttt-service.conf
13+
14+
# Update the server script path on the downloaded upstart conf file
15+
sudo sed -i 's|'/ttt_server.py'|'${TTT_SERVER_SCRIPT_PATH}'|' /etc/init/ttt-service.conf
16+
```
17+
After setting up the upstart configuration script, if you have installed [upstart](http://upstart.ubuntu.com/) on your server machine, the server script will automatically run on system start up. And respawn will start it back up if it is killed or exits non-zero (like an uncaught exception), so the server script can always keep running on your server.
18+
19+
If you want to test the server script on your local machine, you can run [ttt_server.py](http://github.com/CharmySoft/tic-tac-toe-in-python/raw/master/ttt_server.py) with python3:
20+
21+
python3 ttt_server.py [port_number]
622

723
Where the argument *port_number* is a 16-bit unsigned integer port number used for the TCP/IP protocol addressing. You can also run the server script with no arguments, and you will then be asked to enter the and port number.
824

0 commit comments

Comments
 (0)