Systemd unit, init script

This commit is contained in:
DarkCat09 2023-08-31 14:21:38 +04:00
parent 7d1eeccf85
commit c5e55fbcb9
No known key found for this signature in database
GPG Key ID: 0A26CD5B3345D6E3
2 changed files with 40 additions and 0 deletions

27
txtdot.init Normal file
View File

@ -0,0 +1,27 @@
#!/sbin/openrc-run
#export HOST=127.0.0.1
#export PORT=8080
#export REVERSE_PROXY=true
name=$RC_SVCNAME
command="/usr/bin/node"
command_args="./src/app.js"
command_user="txtdot"
directory="/home/txtdot/src/dist"
output_log="/var/log/$RC_SVCNAME/txtdot.log"
error_log="/var/log/$RC_SVCNAME/error.log"
pidfile="/run/$RC_SVCNAME/$RC_SVCNAME.pid"
stopsig="KILL"
command_background="yes"
depend() {
need net
}
start_pre() {
checkpath --directory --owner $command_user:$command_user --mode 0775 \
/run/$RC_SVCNAME /var/log/$RC_SVCNAME
}

13
txtdot.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=txtdot proxy server
After=network.target
[Service]
User=txtdot
Group=txtdot
WorkingDirectory=/home/txtdot/src/dist
ExecStart=/usr/bin/node ./src/app.js
Restart=always
[Install]
WantedBy=default.target