#!/bin/sh thisdate=$(date +%Y%m%d) backupstatus=failed logdir=/home/mercy/backups/logs backupdir=/home/mercy/backups mkdir $backupdir/$thisdate scp root@196.45.188.43:/home/mercy/pictures/*.gz /home/mercy/backups/$thisdate/ && echo $thisdate files downloaded from server into $backupdir >> $logdir/$thisdate.log && backupstatus=success if [ $backupstatus="success" ]; then ls $backupdir/$thisdate/ && echo $thisdate files are in $backupdir/$thisdate >> $logdir/$thisdate.log tar ztvf $backupdir/$thisdate/*.gz && echo $thisdate archive archive checked and decompress correctly. >> $logdir/$thisdate.log && backupstatus=success ls $backupdir/$thisdate/ && backupstatus=failed1 if [ backupstatus = "failed1" ]; then echo $thisdate The files did not download >> $logdir/$thisdate.err else tar ztvf $backupdir/$thisdate/*.gz 2> $logdir/$thisdate.err fi fi thisdate= backupstatus= logdir= backupdir=