Last active
June 17, 2023 19:54
-
-
Save Kiritow/9af800e02c79b8a70f37f3d14589afd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
FRPC_TXT=$(cat <<-END | |
[Unit] | |
Description=frp client service for %i | |
After=network.target | |
[Service] | |
Type=simple | |
User=$USER | |
Restart=on-failure | |
RestartSec=5s | |
ExecStart=$PWD/frpc -c $PWD/conf/client/%i.ini | |
ExecReload=$PWD/frpc reload -c $PWD/conf/client/%i.ini | |
[Install] | |
WantedBy=multi-user.target | |
END | |
) | |
FRPS_TXT=$(cat <<-END | |
[Unit] | |
Description=frp server service for %i | |
After=network.target | |
[Service] | |
Type=simple | |
User=$USER | |
Restart=on-failure | |
RestartSec=5s | |
ExecStart=$PWD/frps -c $PWD/conf/server/%i.ini | |
[Install] | |
WantedBy=multi-user.target | |
END | |
) | |
[ ! -f frpc ] && echo "error: frpc not found" && exit | |
[ ! -f frps ] && echo "error: frps not found" && exit | |
echo "$FRPC_TXT" > [email protected] | |
echo "$FRPS_TXT" > [email protected] | |
mkdir -p conf/ | |
mkdir -p conf/client/ | |
mkdir -p conf/server/ | |
sudo cp [email protected] /etc/systemd/system/ | |
sudo cp [email protected] /etc/systemd/system/ | |
sudo systemctl daemon-reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment