#!/bin/sh # # Test if Bacula can automatically create a Volume label. # TestName="runscript-test" . scripts/functions set_debug 0 copy_test_confs rm -f bin/bacula-dir.conf /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf echo "${cwd}/build" >${cwd}/tmp/file-list start_test cat <${cwd}/tmp/bconcmds @output /dev/null messages label volume=TestVolume001 1 @#setdebug level=100 storage=File @output ${cwd}/tmp/log.RUN2.out run job=RUN_FD_WARNING yes wait @sleep 5 messages run job=RUN_ALL_OK yes wait @sleep 5 messages run job=RUN_FD_FAILED yes wait @sleep 5 messages run job=RUN_DIR_FAILED yes wait @sleep 5 messages st dir quit END_OF_DATA bin/bacula start cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> ${cwd}/tmp/log.RUN1.out stop_bacula if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' ${cwd}/tmp/log.RUN1.out && grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob' ${cwd}/tmp/log.RUN1.out && grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' ${cwd}/tmp/log.RUN1.out && grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob' ${cwd}/tmp/log.RUN1.out then [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok else echo "RUN_ALL_OK in error" rstat=1 fi if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' ${cwd}/tmp/log.RUN1.out && grep -q 'dir: BeforeJob: RunAfterFailedJob' ${cwd}/tmp/log.RUN1.out && true # grep -q 'Backup OK -- with warnings' ${cwd}/tmp/log.RUN1.out then [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok else echo "RUN_DIR_FAILED in error" rstat=1 fi if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' ${cwd}/tmp/log.RUN1.out && grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' ${cwd}/tmp/log.RUN1.out && grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' ${cwd}/tmp/log.RUN1.out then [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok else echo "RUN_FD_FAILED in error" rstat=1 fi if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' ${cwd}/tmp/log.RUN1.out && grep -q 'Backup OK -- with warnings' ${cwd}/tmp/log.RUN1.out then [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok else echo "RUN_FD_WARNING in error" rstat=1 fi