HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=29)
-   -   Scripts (http://www.howtoforge.com/forums/showthread.php?t=36714)

SamTzu 18th June 2009 11:06

Scripts
 
Hi, there.

Can someone enlighten me how you do maintenance on your server?
I would be interested in any scripts you use.
For instance, how to copy/sync folders automatically etc.

falko 19th June 2009 16:00

For what tasks exactly? Backups?

SamTzu 20th June 2009 20:48

Anything. I rarely see ANY scripts and since I'm so poor (read=lazy) at making them my self I'd like to see some that you members find useful.

Backup is good (although I suspect most people use other software like BackupPC or Amanda to do it.)

I'm currently looking a way to ease my life with multiple Joomla updates.
Every time an update comes by I have to extract the zip file and do a copy to all folders under /var/www/domain1.com/web/ folder and then domain2 etc.

Booooring....

Also a script to backup databases to each domain's tmp folder would be a really great.

Anything really. Open stuff is so great because you can just take what you want and modify it to suit your needs.

falko 21st June 2009 16:05

For backups, I'm using a combination of these two tutorials:
http://www.howtoforge.com/back_up_my..._interruptions
http://www.howtoforge.com/mirroring_with_rsync

BorderAmigos 10th July 2009 18:13

I use a couple real simple scripts for backup. They are on cron jobs. The one to copy the websites and database runs every night. They system backup runs once a week. Right now I move the older backups to a different folder then delete them manually but will change it to automatically delete older ones (to not fill up the disk). Note that the location of the backups is a different physical disk than the data being backed up.

backup_sites_database.sh
Quote:

#!/bin/sh
find /media/data/backup/*.tgz -mtime +14 -exec mv {} /media/data/backup/saved_backups \; > /media/data/backup/sites_database_backup_$(date +%y%m%d).txt
tar czPf /media/data/backup/mysql_backup_$(date +%y%m%d).tgz /var/lib/mysql >> /media/data/backup/sites_database_backup_$(date +%y%m%d).txt
tar czPf /media/data/backup/sites_backup_$(date +%y%m%d).tgz /var/www >> /media/data/backup/sites_database_backup_$(date +%y%m%d).txt
backup_system.sh
Quote:

#!/bin/sh
echo "Start Time" > /media/data/backup/system_backup_$(date +%y%m%d).txt
date >> /media/data/backup/system_backup_$(date +%y%m%d).txt
echo "/n Hardware Info" >> /media/data/backup/system_backup_$(date +%y%m%d).txt
hwinfo >> /media/data/backup/system_backup_$(date +%y%m%d).txt
tar czPf /media/data/backup/system_backup_$(date +%y%m%d).tgz --exclude=/proc --exclude=/dev --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys --exclude=/var/spool --exclude=/var/cache --exclude=/var/run --exclude=/media --exclude=/tmp --exclude=/home/servidora/Desktop --exclude=/home/servidora/.aMule/Incoming --exclude=/home/servidora/.aMule/Temp / >> /media/data/backup/system_backup_$(date +%y%m%d).txt
echo "Stop Time" >> /media/data/backup/system_backup_$(date +%y%m%d).txt
date >> /media/data/backup/system_backup_$(date +%y%m%d).txt

Note: Reading Falkos tutorial is a better way of course to back up the mysql databases. I have so little traffic that I'm not very concerned with the data changing while it's being backed up. I may implement the slave mysql server if I have that concern.


All times are GMT +2. The time now is 04:37.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.