Skip to content

Commit

Permalink
ncp-web: fix return value
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Nov 4, 2017
1 parent 961008c commit fa2279f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions nextcloudpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,13 @@ touch /run/ncp.log
chmod 640 /run/ncp.log
chown root:www-data /run/ncp.log
launch_script $1 &> /run/ncp.log
RET=$?
# clean log for the next PHP backend call to start clean,
# but wait until everything from current execution is read
sleep 0.5 && echo "" > /run/ncp.log
exit $RET
EOF
chmod 700 /home/www/ncp-launcher.sh
echo "www-data ALL = NOPASSWD: /home/www/ncp-launcher.sh , /sbin/halt" >> /etc/sudoers
Expand Down
19 changes: 18 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,24 @@ EOF

# log adjustment for wizard
test -f /home/www/ncp-launcher.sh && \
grep -q sleep /home/www/ncp-launcher.sh || echo "sleep 0.5 && echo \"\" > /run/ncp.log" >> /home/www/ncp-launcher.sh
cat > /home/www/ncp-launcher.sh <<'EOF'
#!/bin/bash
DIR=/usr/local/etc/nextcloudpi-config.d
test -f $DIR/$1 || { echo "File not found"; exit 1; }
source /usr/local/etc/library.sh
cd $DIR
touch /run/ncp.log
chmod 640 /run/ncp.log
chown root:www-data /run/ncp.log
launch_script $1 &> /run/ncp.log
RET=$?
# clean log for the next PHP backend call to start clean,
# but wait until everything from current execution is read
sleep 0.5 && echo "" > /run/ncp.log
exit $RET
EOF

# 2 days to avoid very big backups requests to timeout
grep -q TimeOut /etc/apache2/sites-enabled/ncp.conf || \
Expand Down

0 comments on commit fa2279f

Please sign in to comment.