Aide Linux - Liste de diffusion Ze-Linux
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bash] bad interpreter



bonjour tout le monde!

voici un script ecrit en bash :

#!/bin/bash
# This is based on a script I posted a little while
back, basically I just cleaned this up a little bit.
# Just copy the code and save it into a text file on
your server (I called it
/usr/local/sbin/dumpdatabases,
# but feel free to place it in any directory in your
path, and call it whatever you want).
# Just make sure you change the list of databases at
the top to reflect the ones you want to backup,
# and change the username and password for MySQL. Most
other things should be ok, 
# but you might need to change the pathnames if
different on your system.
# Also make sure you do a chmod +x
/usr/local/sbin/dumpdatabases to make it executable.

#
Code:--------------------------------------------------------------------------------

# List all of the MySQL databases that you want to
backup in here, 
# each seperated by a space
databases="essai"

  # Directory where you want the backup files to be
placed
backupdir="/backup"

# MySQL dump command, use the full path name here
mysqldumpcmd="/sda3/usrlocal/mysql/bin/mysqldump"

# MySQL Username and password
userpassword=" --user=root --password=milou"

# MySQL dump options
dumpoptions=" --quick --add-drop-table --add-locks
--extended-insert --lock-tables"

# Unix Commands
gzip="/bin/gzip"
uuencode="/usr/bin/uuencode"
#mail="/bin/mail"

# Send Backup?  Would you like the backup emailed to
you?
# Set to "y" if you do
sendbackup="n"
subject="Your MySQL Backup"
mailto="you@yourdomain.com"

echo 'je passe ici 1'

# Create our backup directory if not already there
mkdir -p ${backupdir}
if [ ! -d ${backupdir} ] 
then
   echo 'Not a directory: ${backupdir}'
   exit 1
fi

# Dump all of our databases
echo "Dumping MySQL Databases"
for database in $databases
do
   $mysqldumpcmd $userpassword $dumpoptions $database
> ${backupdir}/${database}.sql
done

# Compress all of our backup files
echo 'Compressing Dump Files'
for database in $databases
do
   rm -f ${backupdir}/${database}.sql.gz
   $gzip ${backupdir}/${database}.sql
done

# Send the backups via email
if [ $sendbackup = "y" ]
then
   for database in $databases
   do
      $uuencode ${backupdir}/${database}.sql.gz >
${backupdir}/${database}.sql.gz.uu
      $mail -s "$subject : $database" $mailto <
${backupdir}/${database}.sql.gz.uu
   done
fi

# And we're done
ls -l ${backupdir}
echo 'Dump Complete!'
exit

#
--------------------------------------------------------------------------------
# If you want to run this automatically through cron
(recommended so you don't forget): just do a crontab
-e and add the following line:
# 0 3 * * * /usr/local/sbin/dumpdatabases
# This will run it everyday at 3:00am. Feel free to
change the time to something else if you forums aren't
as busy at some other time.

lorsque je l'execute sur mon serveur, j'obtiens ce
message : 

root@ParkMaster:/usr/local/apache/htdocs/scripts#
./backup.sh
: bad interpreter: No such file or directory


c pas pourquoi. une idée?
merci



=====
----------------------------- 
Jo.  littlesnooze@yahoo.fr

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
----------------------------------
Informations, désabonnement, règles, obligations sur la liste Aide-Linux :
http://lists.ze-linux.org/howto_ml.html


Aide Linux - Liste de diffusion Ze-Linux