Handling nodejs within templates

This commit is contained in:
Bob Mottram 2018-04-08 17:00:20 +01:00
parent 26d5dbfa60
commit d7780f284d
1 changed files with 18 additions and 3 deletions

View File

@ -827,7 +827,11 @@ fi
if [ $app_daemon ]; then if [ $app_daemon ]; then
echo '' echo ''
echo " useradd -d \"TODO_PATH_TO_INSTALL\" -s /bin/false ${app_name}" if [[ ! "$app_dir" ]]; then
echo " useradd -d \"TODO_PATH_TO_INSTALL\" -s /bin/false ${app_name}"
else
echo " useradd -d \"${app_dir}\" -s /bin/false ${app_name}"
fi
echo '' echo ''
echo " { echo '[Unit]';" echo " { echo '[Unit]';"
echo " echo 'Description=${app_name}';" echo " echo 'Description=${app_name}';"
@ -843,9 +847,20 @@ if [ $app_daemon ]; then
else else
echo " echo 'WorkingDirectory=${app_dir}';" echo " echo 'WorkingDirectory=${app_dir}';"
fi fi
echo " echo 'ExecStart=TODO';" if [[ ! "$app_nodeapp" ]]; then
if [ ! $app_node ]; then
echo " echo 'ExecStart=TODO';"
else
echo " echo 'ExecStart=/usr/local/bin/npm start';"
echo " echo 'ExecStop=/usr/local/bin/npm stop';"
fi
else
echo " echo 'ExecStart=/usr/local/bin/node $app_nodeapp';"
echo " echo 'Environment=NODE_ENV=production';"
fi
echo " echo 'Environment=USER=${app_name}';"
echo " echo 'Restart=always';" echo " echo 'Restart=always';"
echo " echo 'Environment=\"USER=${app_name}\"';" echo " echo 'StandardError=syslog';"
echo " echo '';" echo " echo '';"
echo " echo '[Install]';" echo " echo '[Install]';"
echo " echo 'WantedBy=multi-user.target'; } >> \"/etc/systemd/system/${app_name}.service\"" echo " echo 'WantedBy=multi-user.target'; } >> \"/etc/systemd/system/${app_name}.service\""