multiple payment options, RT#23741
[freeside.git] / bin / backup-dvd
1 #!/bin/bash
2
3 database="freeside"
4 DEVICE="/dev/hda"
5
6 su freeside -c "pg_dump $database" >/var/backups/$database.sql
7
8 DATE=$(date +%Y-%m-%d)
9
10 #NOTE: These two paths must end in a / in
11 #order to correctly build up the other paths
12 #BACKUP_DIR="/backup/directory/"
13 BACKUP_DIR="/backup/"
14         #TEMP_BACKUP_FILES_DIR="/backup/temp/"
15
16 BACKUP_FILE=$BACKUP_DIR"backup-"$DATE".tar.bz2"
17         #DATABASE_FILE=$TEMP_BACKUP_FILES_DIR"foo-"$DATE".sql"
18
19         #These directories shouldn't end in a / although
20         #I don't think it will cause any problems if
21         #they do. There should be a space at the end though
22         #to ensure the database file gets concatenated correctly.
23         #SOURCE="/a/location /other/locations " $DATABASE_FILE
24
25 #echo Removing old backup directories
26 rm -rf $BACKUP_DIR
27         #rm -rf $TEMP_BACKUP_FILES_DIR
28
29 #echo Creating new backup directories
30 mkdir $BACKUP_DIR
31         #mkdir $TEMP_BACKUP_FILES_DIR
32
33         #echo Creating database backup
34         #pg_dump -U username -f $DATABASE_FILE databaseName
35
36 #echo Backing up $SOURCE to file $BACKUP_FILE
37 #tar -cvpl -f $BACKUP_FILE --anchored --exclude /backup /
38 tar -cjpl -f $BACKUP_FILE --anchored --exclude /backup /
39
40         ##This is not necessary and possibly harmful for DVD+RW media
41         #echo Quick blanking media
42         #dvd+rw-format -blank /dev/hdc
43
44 #echo Burning backup
45 growisofs -dvd-compat -Z $DEVICE -quiet -r -J $BACKUP_FILE