可以自定义systemd中运行软件的用户,用户组同用户
main
AhFei 2023-06-16 23:32:52 +08:00
parent db77d68560
commit 458eb74c94
1 changed files with 6 additions and 5 deletions

View File

@ -11,7 +11,8 @@ WORKSPACE=${2}
passwd=${3}
uid=${4}
server_address=${5}
test_or_not=${6}
user_name=${6}
test_or_not=${7}
mkdir -p ${WORKSPACE}
cd ${WORKSPACE}
@ -31,8 +32,8 @@ Description=ServerStatus-Rust Client
After=network.target
[Service]
User=1000
Group=1000
User=${user_name}
Group=${user_name}
Environment="RUST_BACKTRACE=1"
WorkingDirectory=${WORKSPACE}
# EnvironmentFile=~/myserve/serverstatus/.env
@ -69,8 +70,8 @@ Description=ServerStatus-Rust Server
After=network.target
[Service]
User=1000
Group=1000
User=${user_name}
Group=${user_name}
Environment="RUST_BACKTRACE=1"
WorkingDirectory=${WORKSPACE}
ExecStart=${WORKSPACE}/stat_server -c ${WORKSPACE}/config.toml