Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 23/06/2009, à 14:11

atroxs

Mon script ne marche pas en entier avec cron mais avec le terminale si

Bonjours,

Mon probleme c'est que le script que je fé marche quand je le lance du terminale mais quand je veux le lancer avec le démon cron le script n'est pas exécuter en entier.

J'aimerais savoir pourquoi et si possible régler le problème.

#2 Le 23/06/2009, à 14:12

atroxs

Re : Mon script ne marche pas en entier avec cron mais avec le terminale si

Voici mon script:

#!/bin/bash

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

#**************************************************IMPORTATION DES IP ET DES NOMS D'UTILISATEURS*******************************************************

for i in `cat '/media/C/PROGRAM FILES/EasyPHP 3.0/www/stage/IP.txt'`;
do
for j in `cat '/media/C/PROGRAM FILES/EasyPHP 3.0/www/stage/NomUtilisateur.txt'`;
do

#**************************************************CREATION DES REPERTOIRES DE MONTAGE*******************************************************************
echo "$i ; $j" >> /tmp/cron.log
echo `which smbmount` >> /tmp/cron.log
echo "*" >>/tmp/cron.log
mkdir /tmp/home
mkdir /tmp/notes

#**************************************************MONTAGE DU FICHIER PARTAGÉ**************************************************************************

smbmount -t //$i/$j/ /tmp/home -o username=svgbar,password=password
smbmount -t //$i/notes/ /tmp/notes -o username=svgbar,password=password

#**************************************************TEST D'EXISTANCE DU REPERTOIR DU CLIENT*************************************************************

echo "$i ; $j" >> /tmp/cron.log
echo `which smbmount` >> /tmp/cron.log
echo "*" >>/tmp/cron.log
if [ -d /home/$USER/svg/$j ]; 

#**************************************************SI LE FICHIER EXISTE********************************************************************************

then 

#**************************************************ROULEMENT DES VERSIONS SAUVEGARDES ET SUPPRESSION DE LA PLUS VIEILLE********************************

if [ -d /home/$USER/svg/$j/svg.9 ];
then 
rm -r -d /home/$USER/svg/$j/svg.9
mv /home/$USER/svg/$j/svg.8 /home/$USER/svg/$j/svg.9
mv /home/$USER/svg/$j/svg.7 /home/$USER/svg/$j/svg.8
mv /home/$USER/svg/$j/svg.6 /home/$USER/svg/$j/svg.7
mv /home/$USER/svg/$j/svg.5 /home/$USER/svg/$j/svg.6
mv /home/$USER/svg/$j/svg.4 /home/$USER/svg/$j/svg.5
mv /home/$USER/svg/$j/svg.3 /home/$USER/svg/$j/svg.4
mv /home/$USER/svg/$j/svg.2 /home/$USER/svg/$j/svg.3
mv /home/$USER/svg/$j/svg.1 /home/$USER/svg/$j/svg.2
mv /home/$USER/svg/$j/svg.0 /home/$USER/svg/$j/svg.1
fi



else 

#**************************************************SI LE FICHIER N'EXISTE PAS**************************************************************************

#**************************************************CREATION DES REPERTOIRES DE SAUVEGARDE DU CLIENT****************************************************

mkdir /home/$USER/svg/$j
mkdir /home/$USER/svg/$j/svg.0
mkdir /home/$USER/svg/$j/svg.1
mkdir /home/$USER/svg/$j/svg.2
mkdir /home/$USER/svg/$j/svg.3
mkdir /home/$USER/svg/$j/svg.4
mkdir /home/$USER/svg/$j/svg.5
mkdir /home/$USER/svg/$j/svg.6
mkdir /home/$USER/svg/$j/svg.7
mkdir /home/$USER/svg/$j/svg.8
mkdir /home/$USER/svg/$j/svg.9

fi

#**************************************************SAUVEGARDE******************************************************************************************
cp -pr /tmp/home /home/$USER/svg/$j/svg.0
cp -pr /tmp/notes /home/$USER/svg/$j/svg.0





#*************************************************DEMONTAGE DU FICHIER PARTAGE ET SUPRESSION DU REPERTOIR DE MONTAGE***********************************
smbumount /tmp/home
smbumount /tmp/notes

done
done
#*************************************************FIN**************************************************************************************************

exit 0