From 58412cc4c31eb8dc5d087738aa4a1a2b778cb8c8 Mon Sep 17 00:00:00 2001 From: zamentur Date: Mon, 8 Dec 2014 00:52:36 +0100 Subject: [PATCH] [fix] Service broken [fix] Nothing in ethercalc service log --- conf/ethercalc | 11 +++++------ scripts/install | 7 ++++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/conf/ethercalc b/conf/ethercalc index 121cd50..5240b21 100644 --- a/conf/ethercalc +++ b/conf/ethercalc @@ -1,18 +1,18 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: ethercalc +# Provides: YUNOAPP # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: starts ethercalc -# Description: starts ethercalc using start-stop-daemon +# Short-Description: starts YUNOAPP +# Description: starts YUNOAPP using start-stop-daemon ### END INIT INFO PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin" LOGFILE="/var/log/ethercalc/YUNOLOG.log" -EPLITE_DIR="/usr/local/bin" +EPLITE_DIR="/var/www/YUNOAPP/node_modules/.bin" EPLITE_BIN="ethercalc" USER="YUNOAPP" GROUP="YUNOAPP" @@ -25,8 +25,7 @@ set -e start() { echo "Starting $DESC... " - PORT=YUNOPORT - start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE --basepath YUNOPATH || true + start-stop-daemon --start --chuid "$USER:$GROUP" --chdir $EPLITE_DIR --background --make-pidfile --pidfile /var/run/$NAME.pid --startas /bin/bash -- -c "exec $EPLITE_DIR/$EPLITE_BIN --port YUNOPORT --basepath YUNOPATH > $LOGFILE 2>&1" echo "done" } diff --git a/scripts/install b/scripts/install index aaab532..bcc4d8e 100644 --- a/scripts/install +++ b/scripts/install @@ -31,7 +31,8 @@ echo "Installing EtherCalc with NPM..." final_path=/var/www/$app sudo mkdir -p $final_path sudo useradd -d $final_path $app -su --shell /bin/bash --command "cd $final_path/ && npm install --production $name" $app +sudo chown -R $app: $final_path +sudo su --shell /bin/bash --command "cd $final_path/ && npm install --production $name" $app echo "Cleaning up install tree..." sudo rm -rf $final_path/.npm @@ -39,13 +40,14 @@ find $final_path -type d | grep "test$" | xargs sudo rm -rf find $final_path -type d | grep "tests$" | xargs sudo rm -rf echo "Setting up permissions" -sudo chown -R ghostblog: $final_path +sudo chown -R $app: $final_path echo "Setting up init script..." logfile=/var/log/$name/$app.log sed -i "s@YUNOPORT@$port@g" ../conf/$name sed -i "s@YUNOLOG@$app@g" ../conf/$name sed -i "s@YUNOPATH@$path@g" ../conf/$name +sed -i "s@YUNOAPP@$app@g" ../conf/$name sudo cp ../conf/$name /etc/init.d/$app sudo chmod +x /etc/init.d/$app sudo update-rc.d $app defaults @@ -66,7 +68,6 @@ echo "Nginx configuration ..." sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf* sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf* sed -i "s@YUNOPORT@$port@g" ../conf/nginx.conf* -sed -i "s@YUNOAPP@$app@g" ../conf/nginx.conf* if [ "$path" = "" ]; then sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/$app.conf