This commit is contained in:
14
README.md
14
README.md
@@ -133,8 +133,16 @@ The repo includes `.gitea/workflows/deploy.yaml` which, on push to `main`, SSHes
|
|||||||
If your service name or directory differ, update `SERVICE`/`APP_DIR` in the workflow accordingly.
|
If your service name or directory differ, update `SERVICE`/`APP_DIR` in the workflow accordingly.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
apt update
|
||||||
|
apt install -y sudo
|
||||||
|
|
||||||
echo "deployuser ALL=(root) NOPASSWD: /bin/systemctl restart train-id.service" | sudo tee /etc/sudoers.d/train-id >/dev/null
|
SYSCTL_PATH=$(command -v systemctl) # usually /bin/systemctl or /usr/bin/systemctl
|
||||||
sudo chmod 440 /etc/sudoers.d/train-id
|
cat >/etc/sudoers.d/train-id <<EOF
|
||||||
sudo visudo -cf /etc/sudoers.d/train-id
|
deployuser ALL=(root) NOPASSWD: ${SYSCTL_PATH} restart train-id, ${SYSCTL_PATH} restart train-id.service
|
||||||
|
EOF
|
||||||
|
chmod 440 /etc/sudoers.d/train-id
|
||||||
|
visudo -cf /etc/sudoers.d/train-id
|
||||||
|
|
||||||
|
sudo -n systemctl restart train-id
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user