auto credentials + back_up in arg
Credentials are now getting automaticly and the back_up folder can be parse in arg ( optional ).
This commit is contained in:
parent
f6386a60e7
commit
44427eca48
1 changed files with 17 additions and 5 deletions
|
@ -1,9 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
sound_folder='/srv/airtime/stor/'
|
||||
backup_folder='/home/example/backup/'
|
||||
psql_user='airtime'
|
||||
psql_password='airtime'
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
## Use config
|
||||
backup_folder=~/libretime_backup/
|
||||
else
|
||||
## User arg as config
|
||||
backup_folder=$1
|
||||
fi
|
||||
|
||||
|
||||
airtime_conf_path=/etc/airtime/airtime.conf
|
||||
sound_folder=/srv/airtime/stor/
|
||||
|
||||
psdl_db=$(grep dbname ${airtime_conf_path} | awk '{print $3;}' )
|
||||
psql_user=$(grep dbuser ${airtime_conf_path} | awk '{print $3;}' )
|
||||
psql_password=$(grep dbpass ${airtime_conf_path} | awk '{print $3;}' )
|
||||
|
||||
## Remove old backup
|
||||
rm -rf $backup_folder
|
||||
|
@ -12,7 +24,7 @@ mkdir $backup_folder
|
|||
## Backup of database
|
||||
|
||||
echo 'db: Getting database...'
|
||||
pg_dump --dbname='postgresql://'$psql_user':'$psql_password'@localhost/airtime' > $backup_folder'database'
|
||||
pg_dump --dbname='postgresql://'$psql_user':'$psql_password'@localhost/'$psql_db > $backup_folder'database'
|
||||
echo 'db: Complete'
|
||||
|
||||
## Backup of sounds
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue