bugfix
This commit is contained in:
parent
e30c89c48b
commit
071b9b6995
13
servicify
13
servicify
@ -1,13 +1,13 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ ! -f "start.sh" ] || [ ! -f "stop.sh" ]; then
|
if [ ! -f "start.sh" ] || [ ! -f "stop.sh" ]; then
|
||||||
echo "current folder should have start.sh and stop.sh"
|
echo "current folder should have start.sh and stop.sh"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
workdir=$(pwd)
|
workdir=$(pwd)
|
||||||
servicename=$(basename `pwd`)
|
servicename=$(basename `pwd`)
|
||||||
sudo cat >/etc/systemd/system/$servicename.service <<EOF
|
sudo cat >$servicename.service <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Wants=systemd-networkd.service
|
Wants=systemd-networkd.service
|
||||||
|
|
||||||
@ -16,15 +16,16 @@ Type=forking
|
|||||||
WorkingDirectory=$workdir
|
WorkingDirectory=$workdir
|
||||||
ExecStart=$workdir/start.sh
|
ExecStart=$workdir/start.sh
|
||||||
ExecStop=$workdir/stop.sh
|
ExecStop=$workdir/stop.sh
|
||||||
StandardOutput=append:/var/log/$workdir/$workdir.log
|
StandardOutput=append:/var/log/$servicename/$servicename.log
|
||||||
StandardError=append:/var/log/$workdir/$workdir.log
|
StandardError=append:/var/log/$servicename/$servicename.log
|
||||||
SyslogIdentifier=$workdir
|
SyslogIdentifier=$workdir
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
sudo mkdir /var/log/$workdir
|
sudo cp $servicename.service /etc/systemd/system
|
||||||
|
sudo mkdir /var/log/$servicename
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable $servicename
|
sudo systemctl enable $servicename
|
||||||
sudo systemctl restart $servicename
|
sudo systemctl restart $servicename
|
||||||
|
Loading…
Reference in New Issue
Block a user