1#!/bin/sh 2# 3# Bacula® - The Network Backup Solution 4# 5# Copyright (C) 2000-2020 Kern Sibbald 6# License: BSD 2-Clause; see file LICENSE-FOSS 7# 8# Bacula(R) is a registered trademark of Kern Sibbald. 9# 10# This is a Bacula archive tool for backup/restore files on Docker volumes. 11# Author: Radosław Korzeniewski, radekk@inteos.pl, Inteos Sp. z o.o. 12# 13#echo "EXEC:" $0 14#echo "ARGV:" $* 15 16if [ "x$0" == "x$1" ] 17then 18 shift 1 19fi 20ARGV="backup" 21if [ "x$1" != "x" ] 22then 23 ARGV=$1 24fi 25#echo "params:" $ARGV 26if [ $ARGV == "gimmetheshell" ] 27then 28 exec /bin/sh 29fi 30 31rm -f /logs/docker.err /logs/docker.log 32RC=0 33 34# this is an ack to plugin to confirm proper execution 35echo "200:OK" 36 37case $ARGV in 38 "backup") 39 /tar -cvvf /logs/fout -C /backup . 2> /logs/docker.err > /logs/docker.log 40 RC=$? 41 ;; 42 "restore") 43 /tar -xvvf /logs/fin -C /restore 2> /logs/docker.err > /logs/docker.log 44 RC=$? 45 ;; 46 "*") 47 echo "404:Invalid option!" > /logs/docker.err 48esac 49if [ $RC -ne 0 ] 50then 51 echo "500:exit status: $RC" >> /logs/docker.err 52fi 53exit 0 54