Re: mysql backup script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks to all that responded. The answer was a little different from the one below. So what it came out to was this:
while [ -f $mysqlpid ]
do
sleep 1
/etc/rc.d/init.d/mysqld stop
done


For those that recommended webmin. Although I have webmin installed, because of the type of backups that I needed and how they were to be done, webmin was not an option. Thanks though.
Steve


At 11:29 AM 6/15/2004, Brian Reichert wrote:

On Tue, Jun 15, 2004 at 08:04:00AM -0500, Steve Buehler wrote:
> I am having a problem with a backup script that is written in a shell
> (/bin/sh) script to backup my mysql databases. For some reason on any day
> with an even number I get the following error:
> MySQL could not be stopped, exiting...
> It is really weird because it will run on odd number days without a
> problem. Should I put some kind of a wait in the script after it stops the
> mysqld and before it checks to make sure the pid file is still there? If
> so, does anybody know how? I am not sure that that will solve the problem
> though because it exits afterward and the mysql daemon is still running
> without having to restart it. Below is the relevant part of the script.
> The script is run from cron with this line
> 0 1 * * * /root/backup/backup.sh >/dev/null 2>&1
> But since the logs do show it running, That shouldn't be the problem.
> Thanks
> Steve
>
> ######### Perform myisamchk
> #mysqladmin -p$MYSQLPWD shutdown
> /etc/rc.d/init.d/mysqld stop
> if [ -f $mysqlpid ]; then


Does /etc/rc.d/init.d/mysqld (however indirectly) remove the $mysqlpid file
when it exits?

Is $mysqlpid the same as '/etc/rc.d/init.d/mysqld start' would create?

Couldn't you check for an exit status of '/etc/rc.d/init.d/mysqld stop'
instead?

I've played stupid games like this, to work around weak management
scripts (pseudo-code):

  while( -f $mysqlpid )
    sleep 1
  end

There are risks with that, as well, of course, but you see what it's trying
to do...


-- Brian Reichert <reichert@xxxxxxxxxxx> 37 Crystal Ave. #303 Daytime number: (603) 434-6842 Derry NH 03038-1713 USA BSD admin/developer at large


--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux