Syntax fixes
This commit is contained in:
parent
0478ce746a
commit
6c40c9898d
@ -40,6 +40,7 @@ All configuration options can be found in the `backup.cfg` file. The script has
|
|||||||
| db_username | ------> | Username for DB access |
|
| db_username | ------> | Username for DB access |
|
||||||
| db_password | ------> | Password for DB access |
|
| db_password | ------> | Password for DB access |
|
||||||
| db_name | ------> | Name of database |
|
| db_name | ------> | Name of database |
|
||||||
|
| db_all | ------> | Dumb all databases instead of specific one |
|
||||||
|
|
||||||
To-Do List
|
To-Do List
|
||||||
----------
|
----------
|
||||||
@ -47,4 +48,3 @@ To-Do List
|
|||||||
- [ ] Rsync implementation via shell
|
- [ ] Rsync implementation via shell
|
||||||
- [ ] Rsync implementation via Docker
|
- [ ] Rsync implementation via Docker
|
||||||
- [ ] Cron scheduler
|
- [ ] Cron scheduler
|
||||||
- [ ] Refactor system logs
|
|
24
main.sh
24
main.sh
@ -89,7 +89,7 @@ function logbackup {
|
|||||||
cp /var/log/fail2ban.log $tmpdir/syslogs/
|
cp /var/log/fail2ban.log $tmpdir/syslogs/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$log_backup_web" = true]
|
if [ "$log_backup_web" = true ]
|
||||||
then
|
then
|
||||||
if [ "$apache" = true ]
|
if [ "$apache" = true ]
|
||||||
then
|
then
|
||||||
@ -103,7 +103,7 @@ function logbackup {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$log_purge" = true]
|
if [ "$log_purge" = true ]
|
||||||
then
|
then
|
||||||
echo "Purging logs..." >&2
|
echo "Purging logs..." >&2
|
||||||
truncate -s 0 /var/log/syslog
|
truncate -s 0 /var/log/syslog
|
||||||
@ -134,7 +134,7 @@ function logbackup {
|
|||||||
cp /var/log/fail2ban.log $tmpdir/syslogs/
|
cp /var/log/fail2ban.log $tmpdir/syslogs/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$log_backup_web" = true]
|
if [ "$log_backup_web" = true ]
|
||||||
then
|
then
|
||||||
if [ "$apache" = true ]
|
if [ "$apache" = true ]
|
||||||
then
|
then
|
||||||
@ -148,7 +148,7 @@ function logbackup {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$log_purge" = true]
|
if [ "$log_purge" = true ]
|
||||||
then
|
then
|
||||||
echo "Purging logs..." >&2
|
echo "Purging logs..." >&2
|
||||||
truncate -s 0 /var/log/syslog
|
truncate -s 0 /var/log/syslog
|
||||||
@ -168,14 +168,15 @@ function logbackup {
|
|||||||
truncate -s 0 /var/log/fail2ban.log
|
truncate -s 0 /var/log/fail2ban.log
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function push {
|
function push {
|
||||||
if [ "$rsync_push" = true ]
|
if [ "$rsync_push" = true ]
|
||||||
then
|
then
|
||||||
#Push - Dockerized
|
#Push - Dockerized
|
||||||
if [ "push_clean" = true ]
|
if [ "$push_clean" = true ]
|
||||||
then
|
then
|
||||||
rm /opt/backify-$timestamp.tar.gz
|
rm /opt/backify-$timestamp.tar.gz
|
||||||
fi
|
fi
|
||||||
@ -201,6 +202,7 @@ function dockerbackup {
|
|||||||
if [ "$docker_volumes" = true ]
|
if [ "$docker_volumes" = true ]
|
||||||
then
|
then
|
||||||
echo "Backing up Docker volumes..." >&2
|
echo "Backing up Docker volumes..." >&2
|
||||||
|
#Thanks piscue :)
|
||||||
for i in `docker inspect --format='{{.Name}}' $(docker ps -q) | cut -f2 -d\/`
|
for i in `docker inspect --format='{{.Name}}' $(docker ps -q) | cut -f2 -d\/`
|
||||||
do container_name=$i
|
do container_name=$i
|
||||||
mkdir -p $tmpdir/containers/$container_name
|
mkdir -p $tmpdir/containers/$container_name
|
||||||
@ -247,6 +249,7 @@ function backup_db {
|
|||||||
then
|
then
|
||||||
pg_dump -U "$db_username" "$db_name" -f $tmpdir/db/$db_name.sql
|
pg_dump -U "$db_username" "$db_name" -f $tmpdir/db/$db_name.sql
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function runbackup {
|
function runbackup {
|
||||||
@ -263,14 +266,7 @@ function runbackup {
|
|||||||
# step 3 : vhost backup
|
# step 3 : vhost backup
|
||||||
vhostbackup
|
vhostbackup
|
||||||
# step 4: log backup
|
# step 4: log backup
|
||||||
if [ $system = "rhel" ]
|
logbackup
|
||||||
then
|
|
||||||
logbackuprhel
|
|
||||||
fi
|
|
||||||
if [ $system = "ubuntu" ]
|
|
||||||
then
|
|
||||||
logbackupubuntu
|
|
||||||
fi
|
|
||||||
# step 5: docker backup
|
# step 5: docker backup
|
||||||
dockerbackup
|
dockerbackup
|
||||||
# step 6: db backup
|
# step 6: db backup
|
||||||
|
Loading…
Reference in New Issue
Block a user