Szia, en is csinaltam egy ilyen scriptet. Az enyem egy debian szerveren fut es egy routerre masolja a backupot (amiben van egy merevlemez).
Nekem ez igy mukodik:
### MOUNT
# mount external drive if not already mounted
EXTERNAL_FOLDER='//192.168.0.1/projects'
MOUNT_POINT='/mnt/external'
SUCCESS=1;
TRY=0;
while [ $SUCCESS -ne 0 ] && [ $TRY -lt 3 ]; do
let TRY=TRY+1
# check if the drive is mounted
mount | $GREP $MOUNT_POINT > /dev/null
if [ $? -ne 0 ]; then
# try to mount
mount.cifs $EXTERNAL_FOLDER $MOUNT_POINT -o username=$USER,password=$PASS
SUCCESS=$?
else
SUCCESS=0
fi
done
if [ $SUCCESS -ne 0 ]; then
log_error "Couldn't mount external drive $EXTERNAL_FOLDER to mount point $MOUNT_POINT";
# send mail if error
send_mail
exit
fi
### END MOUNT