1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/bash
# stop on first error
set -e
echo "start testing ... "
echo "TRAVIS_BRANCH: $TRAVIS_BRANCH"
echo "USER: $USER"
echo "DB: $DB"
chown ${daemon_user}:${daemon_group} /etc/bareos/*.conf
chmod ug=rw,o+r /etc/bareos/*.conf
chmod a+rx /etc/bareos/
ls -la /etc/bareos/
case "$DB" in
postgres*)
su postgres -c /usr/lib/bareos/scripts/create_bareos_database
su postgres -c /usr/lib/bareos/scripts/make_bareos_tables
su postgres -c /usr/lib/bareos/scripts/grant_bareos_privileges
;;
*)
/usr/lib/bareos/scripts/create_bareos_database
/usr/lib/bareos/scripts/make_bareos_tables
/usr/lib/bareos/scripts/grant_bareos_privileges
;;
esac
echo "--------- starting services ----------- "
service bareos-dir start
service bareos-sd start
service bareos-fd start
sleep 10
echo "--------- checking services ----------- "
service bareos-dir status
service bareos-sd status
service bareos-fd status
# enable bash debug
set -v
BACKUP_TEST_FILE=/usr/sbin/bareos.test
echo -e "status dir" | bconsole
echo
echo "---- label a volume ----"
echo -e "label volume=testvol pool=Full" | bconsole
echo
echo "----- create some file to test backup / restore ----"
echo "bareos restore test" > ${BACKUP_TEST_FILE}
echo
echo "------ trigger backup job -----"
echo -e "run job=BackupClient1 yes\rwait" | bconsole | grep "Job queued. JobId="
echo "status dir" | bconsole
echo
echo "------ trigger restore job -----"
echo -e "restore select current\r2\rls\rmark usr\rdone\ryes\rwait" | bconsole
echo "status dir" | bconsole
grep "bareos restore test" /tmp/bareos-restores/${BACKUP_TEST_FILE}
|