On Mon, Apr 27, 2015 at 3:24 PM, Arun Khan <[email protected]> wrote:

> On Fri, Apr 24, 2015 at 2:29 PM, Ajeesh Kannan <[email protected]>
> wrote:
> > Hi,
> >
> > my backup script is working when this run manually and in cron jobs. But
> > the script is not taking mysql dump when this is added in
> /etc/cron.hourly
> >
>
> put your own one line cron file in /etc/cron.d  (read 'man 5 crontab')
> to call your script.
>
> > ++++++
> > while read x ; do
> > mysqldump ${x} > "/home/backup/TEST/${x}_`date +%d-%m-%Y`.sql"
> > if [ "$?" -eq "0" ]
>
> string comparison should be quoted, numeric comparison should be unquoted
> e.g  if [ $? -eq 0 ]
>
> > echo "$x backup is OK" >> $STATUSFILE
> > else
> > echo "##### WARNING: ERROR #####  $x backup failed" >> $STATUSFILE
> > fi
> > done</etc/cron.hourly/dbfile
>
> Why is the content of the 'dbfile' and why have put it in /etc/cron.hourly?
>
> Alternately, you can declare a local variable "x=db1 db2 db3 dnN"  in
> the script itself and use
> the "for n in ${x}; do blah blah; done"
>
> > ++++++++++
> >
> > Also tried with mysqldump ${x} > /home/backup/TEST/${x}_`date
> +%d-%m-%Y`.sql
>
> The symbol '%' has a special meaning to cron so you need to escape it
> i.e use \.   (RTFM 'man 5 crontab').
> BTW a lot of people trip on  "%" symbol in cron tab entries.
>
> But the script is working when its add as cron jobs and manual running.
> The only issue is its not working when it placed in /etc/cron.daily or
> hourly.
>

##### WARNING: ERROR ##### <db_name> backup failed
And the mysql dump is showing 0MB size in the backup location.


-- 
With Regards,
Ajeesh B.Kannan
_______________________________________________
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
ILUGC Mailing List Guidelines:
http://ilugc.in/mailinglist-guidelines

Reply via email to