forked from lamw/ghettoVCB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghettoVCB-backup-wrap.sh
executable file
·47 lines (39 loc) · 1.2 KB
/
ghettoVCB-backup-wrap.sh
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
# Author: Mart Verburg
# http://datamind.no
# Created Date: 2015-04-14
# published on GitHub.com in Datamind fork Datamind-dot-no/da-ghettoVCB
# forked from lamw/ghettoVCB
##
# ghettoVCB-backup-wrap.sh
# - a wrapper for more comprehensible invocations from cron job or cli
#
# First argument is the list name. The list name is assumed to start
# with this script name minus the -wrap.sh
#
# Remaining arguments are passed to the regular main GhettoVCB.sh script
#
# Where we want the logs sent
LOGDIR=/vmfs/volumes/datastore1/log/da-ghettoVCB
##
## No need to edit anything below here
## -- unless you think you're more of a hacker like me ;-)
##
# establish the working dir
# Used to be hardcoded like so:
# WORKDIR=/vmfs/volumes/datastore1/scripts/backup/ghettoVCB
#
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
STRIP="-wrap.sh"
SCRIPTNAME=$(basename "$SCRIPT")
#LISTNAME="${$SCRIPTNAME/$STRIP/$1}"
LISTNAME="$(echo $SCRIPTNAME | sed -e "s/${STRIP}/-${1}/")"
cd $SCRIPTPATH
# in order to keep the first argument for this wrapper, and pass the rest
# over to the main script
shift 1
./ghettoVCB.sh \
-g ghettoVCB.conf \
-l $LOGDIR/$(date +%F_%H-%M-%S)-log-$LISTNAME \
-f $LISTNAME \
"$@"