Add automatic starting of SVR.JS server after installing SVR.JS

This commit is contained in:
Dorian Niemiec 2024-04-05 14:48:46 +02:00
parent 4893969772
commit 993df1eea4

View file

@ -15,6 +15,7 @@ if [ "$(id -u)" != "0" ]; then
exit 1 exit 1
fi fi
##Determine the OS
OS="$(uname -s)" OS="$(uname -s)"
if [ "$OS" == "Linux" ]; then if [ "$OS" == "Linux" ]; then
if [ -f /etc/redhat-release ] ; then if [ -f /etc/redhat-release ] ; then
@ -290,6 +291,7 @@ if [ "$systemddetect" == "" ]; then
echo 'exit $RETVAL' >> /etc/init.d/svrjs echo 'exit $RETVAL' >> /etc/init.d/svrjs
chmod a+x /etc/init.d/svrjs chmod a+x /etc/init.d/svrjs
update-rc.d svrjs defaults update-rc.d svrjs defaults
/etc/init.d/svrjs start
else else
echo '[Unit]' > /etc/systemd/system/svrjs.service echo '[Unit]' > /etc/systemd/system/svrjs.service
echo 'Description=SVR.JS web server' >> /etc/systemd/system/svrjs.service echo 'Description=SVR.JS web server' >> /etc/systemd/system/svrjs.service
@ -304,6 +306,7 @@ else
echo '[Install]' >> /etc/systemd/system/svrjs.service echo '[Install]' >> /etc/systemd/system/svrjs.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/svrjs.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/svrjs.service
systemctl enable svrjs systemctl enable svrjs
systemctl start svrjs
fi fi
echo "Done! SVR.JS is installed successfully!" echo "Done! SVR.JS is installed successfully!"