Commit bae08f83 authored by Isabella Skořepová's avatar Isabella Skořepová

Fix upload script

It wasn't working when run from different directory than one it was
stored in

And update it to work in correct directory
parent 10658321
Pipeline #201 passed with stages
......@@ -6,6 +6,14 @@ then
fi
export PASSWORD=$LFTP_PASSWORD
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
USER=ok1kvk.cz-www-nove
HOST=krios.blueboard.cz
MAX_RETRIES=2
......@@ -15,7 +23,7 @@ echo "======================================================================"
echo "Uploading to $HOST"
if [ "$1" == "ftp" ]; then
echo "Using FTP"
time lftp -e "set cmd:fail-exit yes;\
/usr/bin/time -f "Upload took %e" -- lftp -e "set cmd:fail-exit yes;\
set net:timeout 5;\
set net:reconnect-interval-base $RECONNECT_INTERVAL;\
set net:max-retries $MAX_RETRIES;\
......@@ -27,7 +35,7 @@ if [ "$1" == "ftp" ]; then
echo "LFTP finished with return code $RET"
else
echo "Using SFTP"
/usr/bin/time -f "Upload took %e" -- node sftp-sync.js --sourcedir build --server $HOST --user $USER --remotedir /test --port 2121
/usr/bin/time -f "Upload took %e" -- node $DIR/sftp-sync.js --sourcedir build --server $HOST --user $USER --remotedir / --port 2121
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