Add linux server scripts

This commit is contained in:
世界 2022-07-30 08:39:34 +08:00
parent 0f7f800e95
commit 9b9b5ebb72
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
6 changed files with 75 additions and 0 deletions

14
release/local/config.json Normal file
View File

@ -0,0 +1,14 @@
{
"log": {
"level": "info"
},
"inbounds": [
{
"type": "shadowsocks",
"listen": "::",
"listen_port": 8080,
"method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg=="
}
]
}

7
release/local/enable.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e -o pipefail
sudo systemctl enable sing-box
sudo systemctl start sing-box
sudo journalctl -u sing-box --output cat -f

16
release/local/install.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e -o pipefail
DIR=$(dirname "$0")
PROJECT=$DIR/../..
pushd $PROJECT
go install -v -trimpath -ldflags "-s -w -buildid=" -tags "no_gvisor" ./cmd/sing-box
popd
sudo cp $(go env GOPATH)/bin/sing-box /usr/local/bin/
sudo mkdir -p /usr/local/etc/sing-box
sudo cp $DIR/config.json /usr/local/etc/sing-box/config.json
sudo cp $DIR/sing-box.service /etc/systemd/system
sudo systemctl daemon-reload

View File

@ -0,0 +1,13 @@
[Unit]
Description=sing-box service
Documentation=https://sing-box.sagernet.org
After=network.target nss-lookup.target
[Service]
ExecStart=/usr/local/bin/sing-box run -c /usr/local/etc/sing-box/config.json
Restart=on-failure
RestartSec=10s
LimitNOFILE=infinity
[Install]
WantedBy=multi-user.target

7
release/local/uninstall.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
sudo systemctl stop sing-box
sudo rm -rf /usr/local/bin/sing-box
sudo rm -rf /usr/local/etc/sing-box
sudo rm -rf /etc/systemd/system/sing-box.service
sudo systemctl daemon-reload

18
release/local/update.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e -o pipefail
DIR=$(dirname "$0")
PROJECT=$DIR/../..
pushd $PROJECT
git fetch
git reset FETCH_HEAD --hard
git clean -fdx
go install -v -trimpath -ldflags "-s -w -buildid=" -tags "no_gvisor" ./cmd/sing-box
popd
sudo systemctl stop sing-box
sudo cp $(go env GOPATH)/bin/sing-box /usr/local/bin/
sudo systemctl start sing-box
sudo journalctl -u sing-box --output cat -f