Commit 1154d14b authored by Isabella Skořepová's avatar Isabella Skořepová

Better error handling

parent 22eb11ae
Pipeline #124 passed with stage
......@@ -3,6 +3,8 @@ before_script:
- ./configure.sh
upload:
only:
- master
script:
- ./upload
......
......@@ -51,6 +51,7 @@ var sitegin = function(config) {
.catch(function(e) {
isRunning = false;
console.log('Generator crashed in',moment().diff(startTime,'seconds'),'seconds')
if(config.options.noserver) process.exit(13);
if(runAgain) run();
if(e.stack)
console.log(e.stack)
......
......@@ -8,7 +8,12 @@ fi
rm -rf build
mkdir -p build/theme
time node index.js --noserver
echo "Site compiled"
echo "Site compilation ended with status code $?"
if [ $? -ne 0 ]
then
echo "Error detected. Exitting."
exit 1
fi
chmod a+X build -R
USER=ok1kvk.cz-www-nove
......@@ -17,22 +22,29 @@ MAX_RETRIES=2
RECONNECT_INTERVAL=5
echo "======================================================================"
echo "Uploading to nove.ok1kvk.cz"
echo "Uploading to $HOST"
if [ "$1" == "ftp" ]; then
echo "Using FTP"
time lftp -c "set cmd:fail-exit yes;\
time lftp -e "set cmd:fail-exit yes;\
set net:timeout 5;\
set net:reconnect-interval-base $RECONNECT_INTERVAL;\
set net:max-retries $MAX_RETRIES;\
set ftp:ssl-allow no;\
open --user $USER --env-password ftp://$HOST/;\
mirror -c --verbose=9 -e -R -L ./build /"
mirror -c --verbose=9 -e -R -L ./build /;\
exit 0;"
echo "LFTP finished with return code $?"
else
echo "Using SFTP"
time lftp -c "set cmd:fail-exit yes;\
time lftp -e "set sftp:auto-confirm yes;\
set cmd:fail-exit yes;\
set net:timeout 5;\
set net:reconnect-interval-base $RECONNECT_INTERVAL;\
set net:max-retries $MAX_RETRIES;\
open --user $USER --env-password -p 2121 sftp://$HOST/;\
mirror -c --verbose=9 -e -R -L ./build /"
mirror -c --verbose=9 -e -R -L ./build /;\
exit 0;"
echo "LFTP finished with return code $?"
fi
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment