On 5/18/07, Ian Dexter R. Marquez <[EMAIL PROTECTED]> wrote:

On 5/18/07, jan gestre <[EMAIL PROTECTED]> wrote:
>
>
> On 5/18/07, joebert jacaba <[EMAIL PROTECTED]> wrote:
> > im curious, your script doesnt echo something. the behavior you are
> > getting are just right to m.
>
> where would i place echo in the script? or where would i place it when
run
> outside the script?

Something like this:

MYSQLDUMP=/path/to/mysqldump
.
.
.
$MYSQLDUMP [options]
if [ "$?" == "0" ]; then
MSG="Successful"
else
MSG="Failed"
fi
mail -s $MSG [EMAIL PROTECTED]


Better if you set up a log file where you can track all backups:

LOGFILE=/path/to/logfile

echo `date` >> $LOGFILE
echo "Start backup" >> $LOGFILE
$MYSQLDUMP [options]
if [ "$?" == "0" ]; then
MSG="Successful"
else
MSG="Failed"
fi
echo $MSG >> $LOGFILE
mail -s $MSG [EMAIL PROTECTED] < $LOGFILE


these are some of the scripts based on Ian's recommendation:

-------------------------
#!/bin/sh
BACKUP=/usr/bin/mysqldump
DBUSER=username
DBPASS=password
EMAIL="[EMAIL PROTECTED]"
LOGFILE=/home/username/DBLogs/logfile
######## Start the Backup ############
echo `date` >> $LOGFILE
echo "Start BackUp" >> $LOGFILE
cd /media/FreeAgent_Drive/DBbackup/
#
$BACKUP db1 -u$DBUSER -p$DBPASS > db1_before.sql
#
$BACKUP db2 -u$DBUSER -p$DBPASS > db2_before.sql
#
if [ "$?" == "0" ]; then
MSG="Successful DBBackUP-Before"
else
MSG="Failed DBBackUp-Before"
fi
echo $MSG >> $LOGFILE
mailx -s $MSG $EMAIL < $LOGFILE
--------------------------------

the error from the maillog i saw when i manually run this script is :

8-bit character in mailbox address "[EMAIL PROTECTED]"

the email was not sent and the scripts seems to run forever, taking too much
time.

then i also ran this script, as you can see instead of placing the email
address on a variable., i entered it directly, however the scripts seems to
run forever, i had to kill the mailx process for it to end.
------------------------------------
#!/bin/sh
#
SYNC=/usr/bin/mysql
DBUSER=username
DBPASS=password
cd /home/username/scripts/
$SYNC -u$DBUSER -p$DBPASS < sql_sync.sql
if [ "$?" == "0" ]; then
MSG="Successful SYNC"
else
MSG="Failed SYNC"
fi
mailx -s $MSG [EMAIL PROTECTED]

------------

what do you think is the reason why it is behaving that way?
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph

Reply via email to