Hi Michael,

Thanks a lot. Perhaps you can also post it on the wiki so that other can make use of your work
http://wiki.voyage.hk.

Regards,
Punky


Michael Fung wrote:
Hello all,

I have an application that updates the data tables heavily. I worked out these 
and may be someone need it too.

Put backup-mydb.sh in /usr/local/bin
Edit and run the backup-mydb.sh script (set ROOTPW, ...etc)

Create mount point for new datadir:
Edit /etc/fstab , add lines:
# for mysql:
tmpfs           /var/mysqldata  tmpfs   defaults,size=16M       0 2

run:
mount /var/mysqldata
df -h
You see this line in the output:
tmpfs                  16M  1.2M   15M   8% /var/mysqldata


shutdown mysql, run:
invoke-rc.d mysql stop
Edit /etc/mysql/my.cnf, set
datadir   = /var/mysqldata

replace /etc/init.d/mysql with the attached modified version.
(the modified one is based on 5.0.51a-24+lenny2)

start mysql, run
invoke-rc.d mysql start
The script will automatically restore all data files to /var/mysqldata

You can also run backup-mydb.sh by cron periodically.

Next time when you normally shutdown the system, the data files is auto backed 
up.
When the system restart, the data files is auto restored.

Your comments are welcome.
- Michael

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

_______________________________________________
Voyage-linux mailing list
[email protected]
http://list.voyage.hk/mailman/listinfo/voyage-linux


--
Regards,
Punky

Voyage Solutions (http://solution.voyage.hk)
* Embedded Solutions and Systems
 - Mesh Networking, Captive Portal, IP Surveillance, VoIP/PBX
 - Network Engineering, Development Platform and Consultation


_______________________________________________
Voyage-linux mailing list
[email protected]
http://list.voyage.hk/mailman/listinfo/voyage-linux

Reply via email to