Commit a515c369 authored by Dillenn Terumalai's avatar Dillenn Terumalai
Browse files

Fixed some issues regarding connectivity

parent 70fe582f
ID=labo1
SFTP_URL=${ID}@spsp-sftp.vital-it.ch:/data
\ No newline at end of file
HOST=spsp-sftp.vital-it.ch
SFTP_URL=${ID}@${HOST}:/data
\ No newline at end of file
......@@ -210,10 +210,17 @@ if [ $# -gt 0 ]; then
fi
LOGFILE="./logs/spsp-$CURRENTDATE.log"
if [ ! -f $LOGFILE ]; then
touch $LOGFILE
fi
echo ""
if ! nc -w 1 -z ${HOST} 22 &> /dev/null;then
echo "[`date +"%T"`] local.ERROR: ${HOST}:22 is unreachable, please check your connection" >> $LOGFILE
echo "SPSP: Error detected please check $LOGFILE"
exit 0
fi
for DIRECTORY in *; do
if [ -d "$DIRECTORY" ] && [ $DIRECTORY != $OUTBOX ] && [ $DIRECTORY != $SENT ] && [ $DIRECTORY != $LOGS ]; then
if ls $DIRECTORY/*.fastq* 1> /dev/null 2>&1 && [ -f $DIRECTORY/*.xlsx ]; then
......@@ -224,13 +231,13 @@ if [ $# -gt 0 ]; then
rm -rf $DIRECTORY
mv $DIRECTORY.tar.gz ./outbox/.
else
echo "[`date +"%T"`] local.ERROR: Missing files (*.fastq or *.xlsx) inside ${DIRECTORY}" >> $LOGFILE
echo "[`date +"%T"`] local.ERROR: Missing files (*.fastq/.fastq.gz and/or *.xlsx) inside ${DIRECTORY}" >> $LOGFILE
echo "SPSP: Error detected please check $LOGFILE"
exit 0
fi
fi
done
echo ""
for FILE in ./outbox/*; do
if [ -f "$FILE" ]; then
echo "SPSP: Signing $FILE using SHA-256 algorithm..."
......@@ -255,10 +262,6 @@ if [ $# -gt 0 ]; then
exit 0
fi
echo ""
else
echo "[`date +"%T"`] local.ERROR: No file found inside output directory" >> $LOGFILE
echo "SPSP: Error detected please check $LOGFILE"
exit 0
fi
done
echo ""
......@@ -282,7 +285,7 @@ if [ $# -gt 0 ]; then
encryptFile $@
else
message="Command does not exist, please check the help\n ${COL_LGREEN}/script.sh help${COL_RESET}"
message="Command does not exist, please check the help\n ${COL_LGREEN}./script.sh help${COL_RESET}"
printf "$message\n"
fi
fi
\ No newline at end of file
Supports Markdown
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