1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ethercalc_ynh.git synced 2024-09-03 18:26:36 +02:00

[fix] Service broken

[fix] Nothing in ethercalc service log
This commit is contained in:
zamentur 2014-12-08 00:52:36 +01:00
parent 15cfa1504e
commit 58412cc4c3
2 changed files with 9 additions and 9 deletions

View file

@ -1,18 +1,18 @@
#!/bin/sh #!/bin/sh
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: ethercalc # Provides: YUNOAPP
# Required-Start: $local_fs $remote_fs $network $syslog # Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: starts ethercalc # Short-Description: starts YUNOAPP
# Description: starts ethercalc using start-stop-daemon # Description: starts YUNOAPP using start-stop-daemon
### END INIT INFO ### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/ethercalc/YUNOLOG.log" LOGFILE="/var/log/ethercalc/YUNOLOG.log"
EPLITE_DIR="/usr/local/bin" EPLITE_DIR="/var/www/YUNOAPP/node_modules/.bin"
EPLITE_BIN="ethercalc" EPLITE_BIN="ethercalc"
USER="YUNOAPP" USER="YUNOAPP"
GROUP="YUNOAPP" GROUP="YUNOAPP"
@ -25,8 +25,7 @@ set -e
start() { start() {
echo "Starting $DESC... " echo "Starting $DESC... "
PORT=YUNOPORT 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"
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE --basepath YUNOPATH || true
echo "done" echo "done"
} }

View file

@ -31,7 +31,8 @@ echo "Installing EtherCalc with NPM..."
final_path=/var/www/$app final_path=/var/www/$app
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo useradd -d $final_path $app 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..." echo "Cleaning up install tree..."
sudo rm -rf $final_path/.npm 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 find $final_path -type d | grep "tests$" | xargs sudo rm -rf
echo "Setting up permissions" echo "Setting up permissions"
sudo chown -R ghostblog: $final_path sudo chown -R $app: $final_path
echo "Setting up init script..." echo "Setting up init script..."
logfile=/var/log/$name/$app.log logfile=/var/log/$name/$app.log
sed -i "s@YUNOPORT@$port@g" ../conf/$name sed -i "s@YUNOPORT@$port@g" ../conf/$name
sed -i "s@YUNOLOG@$app@g" ../conf/$name sed -i "s@YUNOLOG@$app@g" ../conf/$name
sed -i "s@YUNOPATH@$path@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 cp ../conf/$name /etc/init.d/$app
sudo chmod +x /etc/init.d/$app sudo chmod +x /etc/init.d/$app
sudo update-rc.d $app defaults 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@PATHTOCHANGE@$path@g" ../conf/nginx.conf*
sed -i "s@ALIASTOCHANGE@$final_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@YUNOPORT@$port@g" ../conf/nginx.conf*
sed -i "s@YUNOAPP@$app@g" ../conf/nginx.conf*
if [ "$path" = "" ]; if [ "$path" = "" ];
then then
sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf-nosub /etc/nginx/conf.d/$domain.d/$app.conf