Backup same directories or files and compress them with tar.gz
#!/bin/bash
#
# creates backups of essential files
#
TRAC="/opt/trac_root"
SVN="/opt/svn_root"
SMB="/opt/smb_root"
LIST="/tmp/backlist_$$.txt"
set $(date)
# full backup: TRAC / SVN
#
tar cfz "/var/MyBackup/trac/trac_full_$6-$2-$3.tgz" $TRAC
#
tar cfz "/var/MyBackup/svn/svn_full_$6-$2-$3.tgz" $SVN
if test "$1" = "dim" ; then
# weekly a full backup of smb
#
tar cfz "/var/MyBackup/smb/smb_full_$6-$2-$3.tgz" $SMB
rm -f /var/MyBackup/smb/smb_diff*
else
# incremental backup:
#
find $SMB -depth -type f \( -ctime -1 -o -mtime -1 \) -print > $LIST
tar cfzT "/var/MyBackup/smb/smb_diff_$6-$2-$3.tgz" "$LIST"
rm -f "$LIST"
fi
Not very big script, but it can be helpful if you don’t remember how to write mysqldump
mysqldump -r /home/job/MyDump.sql mydatabase -u root -p
Installation of a Subversion repository, with apache configuration:
Link: svnbook.red-bean.com
$ svnadmin create /path/to/repos
$ mkdir trunk branches tags
$svn import /home/moi/monprojet file:///path/to/repos
// for print out
$svn list --verbose file:///home/svn/monprojet
$ ### First time: use -c to create the file
$ ### Use -m to use MD5 encryption of the password, which is more secure
$ htpasswd -cm /etc/svn-auth-file harry
New password: *****
Re-type new password: *****
Adding password for user harry
$ htpasswd -m /etc/svn-auth-file sally
New password: *******
Re-type new password: *******
Adding password for user sally
$
httpd.conf
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_svn_module modules/mod_dav_svn.so
<Directory /home/job/Devel/svn_root>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Location /svn>
DAV svn
SVNParentPath /home/job/Devel/svn_root
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /home/job/Devel/svn_root/svn.htpasswd
Require valid-user
</Location>