Answer the question
In order to leave comments, you need to log in
What is wrong with writing the script?
#!/bin/sh
OBNAM=/usr/bin/obnam
CREDENTIALS=/root/.smbclient
BAK_SHARE1_SRC=//192.168.0.1/share1
BAK_SHARE1_DST=/mnt/share1
BAK_SHARE2_SRC=//192.168.66.4/share2
BAK_SHARE2_DST=/mnt/share2
BAK_STOR=/backup
LOCK=$BAK_SHARE2_DST/success.lock
mount -o remount,rw $BAK_STOR
mount -t cifs $BAK_SHARE1_SRC $BAK_SHARE1_DST -o ro,credentials=$CREDENTIALS
mount -t cifs $BAK_SHARE2_SRC $BAK_SHARE2_DST -o ro,credentials=$CREDENTIALS
if [ -f $LOCK ];
$OBNAM backup;
elif [ ! -f $LOCK ]; then
echo 'Lockfile not found!' >> /var/log/obnam.log;
fi
umount $BAK_SHARE2_DST
umount $BAK_SHARE1_DST
mount -o remount,ro $BAK_STOR
$OBNAM backup;
execution of the script continues. That is, the commands below the condition for checking the existence of a file are executed - network folders are unmounted. $OBNAM backup;
?
Answer the question
In order to leave comments, you need to log in
Add "wait" command
.....
...
if [ -f $LOCK ];
$OBNAM backup;
elif [ ! -f $LOCK ]; then
echo 'Lockfile not found!' >> /var/log/obnam.log;
fi
wait
umount $BAK_SHARE2_DST
umount $BAK_SHARE1_DST
mount -o remount,ro $BAK_STOR
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question