Probleme montage Samba

Top Page

Reply to this message
Author: Adrien Revol
Date:  
To: guilde
Old-Topics: Re: superposer deux images
Subject: Probleme montage Samba
Bonjour,

Je rencontre un problème étrange sur une machine qui lance des scripts
de montages samba planifiés, en vue de faire des sauvegardes.

Au moment du lancement du montage j'obtiens l'erreur suivante:
Can't get /etc/mtab~ lock filesmbmnt failed: 1

Cette erreur n'est pas systématique, j'ai également d'autres scripts qui
tournent et qui ne posent pas de problème... ce n'est pas non plus un
problème dans mon script car cette erreur n'apparaît pas à chaque fois.
Cela ne semble pas non plus dû à la machine dont le partage est monté:
l'erreur survient avec différents serveurs, aléatoirement.

Google n'a pas pu m'aider. Si quelqu'un à une idée de l'origine du
problème, je suis preneur ...

voici mon script (dsl si c'est pas très lisible ... je le mets en PJ
également) :

#!/bin/sh

# Machine ou se connecter
HOST='djerba'

# Repertoire partage de la machine
SHARE='E'

# Destination des points de montages
PATH_MNT='/backups/mnt'

# Repertoire Temporaire
TEMP_PATH='/backups/djerba/tmp'

# Fichiers contenant les logins/motdepasses
FILE_CREDENTIALS='/backups/scripts/access_smbpwd_DJERBA.txt'

# Device (dd externe) destination a monter/demonter
DEVICE_DEST='/media/Bck_Quot_2'

# Repertoire destination des backups
BACKUPS_DIRECTORY_DEST="${DEVICE_DEST}"

# Repertoire origine des backups
BACKUPS_DIRECTORY_ORIGIN="${PATH_MNT}/${HOST}/${SHARE}"

# Date actuelle
CURRENT_DATE=$(date +%Y%m%d)


# Fonction de montage de systemes de fichier
function monter {
t=`echo ${1} | sed -e 's/^.//'`
chemin="${PATH_MNT}${t}"
if [[ ! -d ${chemin} ]]; then
mkdir -p ${chemin}
fi
smbmount ${1} ${chemin} -o credentials=${FILE_CREDENTIALS}
}


# Debut du programme

/usr/bin/clear

echo "--------- DAILY BACKUPS COMPRESSION Program ${HOST}--------"

echo ""
echo "[PHASE-1]-Initialisation"
echo "Server's share is being mounted... Please wait"
monter "//${HOST}/${SHARE}"
echo "-- Done --"

echo ""

echo "[PHASE-2]-Downloading"
echo "Files are being downloaded now - This may take a long time, be
patient"
echo "..."
time find ${BACKUPS_DIRECTORY_ORIGIN} -name *.BAK -type f -exec cp "{}"
${TEMP_PATH} \;
echo "-- Done --"

echo ""

echo "[PHASE-3]-Compression"
echo "Compression in Progress ..."
echo "..."
cd ${TEMP_PATH}
find * -type f -print > /tmp/lastBackup-${HOST}-${CURRENT_DATE}.list
time tar cfzT ${BACKUPS_DIRECTORY_DEST}/${CURRENT_DATE}_
{$HOST}_backup.tar.gz /tmp/lastBackup-${HOST}-${CURRENT_DATE}.list
echo "-- Done ---"

echo ""

echo "[PHASE-4]-Deleting old and temp files"
echo "Deleting downloaded files which have been compressed"
echo "..."
time rm -f ${TEMP_PATH}/*
echo "-- Done --"

echo ""

echo "Deleting backuped files which still on the server"
echo "..."
time find ${BACKUPS_DIRECTORY_ORIGIN} -name *.BAK -type f -exec rm -f
"{}" \;

echo "[PHASE-5]-Umounting Filesystems"
echo "Umounting server's share filesystem"
echo "..."
smbumount ${BACKUPS_DIRECTORY_ORIGIN}
echo "-- Done --"
echo "[PHASE-2]-Downloading"
echo "Files are being downloaded now - This may take a long time, be
patient"
echo "..."
time find ${BACKUPS_DIRECTORY_ORIGIN} -name *.BAK -type f -exec cp "{}"
${TEMP_PATH} \;
echo "-- Done --"

echo ""

echo "[PHASE-3]-Compression"
echo "Compression in Progress ..."
echo "..."
cd ${TEMP_PATH}
find * -type f -print > /tmp/lastBackup-${HOST}-${CURRENT_DATE}.list
time tar cfzT ${BACKUPS_DIRECTORY_DEST}/${CURRENT_DATE}_
{$HOST}_backup.tar.gz /tmp/lastBackup-${HOST}-${CURRENT_DATE}.list
echo "-- Done ---"

echo ""

echo "[PHASE-4]-Deleting old and temp files"
echo "Deleting downloaded files which have been compressed"
echo "..."
time rm -f ${TEMP_PATH}/*
echo "-- Done --"

echo ""

echo "Deleting files older than 7 days on the device"
echo "..."
#time find ${BACKUPS_DIRECTORY_DEST}/*mayotte* -type f -exec rm -f "{}"
\;
echo "-- Done --"

echo ""

echo "Deleting backuped files which still on the server"
echo "..."
time find ${BACKUPS_DIRECTORY_ORIGIN} -name *.BAK -type f -exec rm -f
"{}" \;

echo "[PHASE-5]-Umounting Filesystems"
echo "Umounting server's share filesystem"
echo "..."
smbumount ${BACKUPS_DIRECTORY_ORIGIN}
echo "-- Done --"

echo ""

echo "[FINISHED]"