Skip to content

Commit

Permalink
add ss server.log
Browse files Browse the repository at this point in the history
  • Loading branch information
DinoStray committed Sep 5, 2018
1 parent daca4b5 commit 17d761b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Docker of shadowsocks

* automatically restart while ss server OOM
* automatically clean up logs

you should change the following parameters of docker run cmd:

* SS_PORT the port of ss server
* SS_PWD the password used for client connection
* SS_METHOD encryption method
* -p 5050:5050 the same as SS_PORT

# run
```bash
docker run \
Expand All @@ -16,14 +28,25 @@ docker exec -it shadowsocks bash

# tail logs
```bash
# tail standard output of docker
docker logs --tail 50 --follow --timestamps shadowsocks
# or tail ssserver log
docker exec -it shadowsocks bash
less ${SS_HOME}/ssserver.log
```

# build by yourself
# PS: build by yourself
```bash
# build
docker build -t shadowsocks .
docker tag shadowsocks vvqboy/shadowsocks:latest
docker push vvqboy/shadowsocks:latest
# run
docker run \
--env SS_PORT=5050 \
--env SS_PWD=password \
--env SS_METHOD=aes-256-cfb \
--name shadowsocks --restart always \
-p 5050:5050 \
-d shadowsocks
```

# PS: install docker
Expand Down
8 changes: 8 additions & 0 deletions logrotate
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ ${SS_HOME}/ssserver_restart.log {
missingok
copytruncate
}

${SS_HOME}/ssserver.log {
daily
rotate 14
dateext
missingok
copytruncate
}
5 changes: 3 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env bash

LOG_PATH=${SS_HOME}/ssserver_restart.log
RESTART_LOG_PATH=${SS_HOME}/ssserver_restart.log
SS_LOG_PATH=${SS_HOME}/ssserver.log
TIME_STR=`date "+%Y-%m-%d %H:%M:%S"`
echo "${TIME_STR} restart again" >> $LOG_PATH

bash ${SS_HOME}/make_conf.sh > ${SS_HOME}/ss_conf.json

ssserver -c ${SS_HOME}/ss_conf.json start
ssserver -c ${SS_HOME}/ss_conf.json start >> ${SS_LOG_PATH} 2>&1

0 comments on commit 17d761b

Please sign in to comment.