summaryrefslogtreecommitdiff
path: root/sysutils/tsm8/files/tsm_daily.sh
blob: 134d5bc29f45ab9dab15c3611c468c73dee90850 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
#
# Sample TSM startup file, adjust to your requirements and
# call from e.g /etc/daily.local
#
# Daily (nightly) backup via Tivoli Storage Manager (IBM ADSM)
# Set up environment, wrap logfiles and start dsmc.
#
# NetBSD configuration hints:
#
#  - TSM expects ${EMULDIR}/etc/mtab to exist and be meaningful. The current 
#    suse91_base package sets up a symlink to ${EMULDIR}/proc/mounts which 
#    works on NetBSD 3 if you mount procfs in /etc/fstab like
#
#      procfs  /emul/linux/proc  procfs  ro,linux  0 0
#
#    Alternatively, make ${EMULDIR}/etc/mtab a symlink to /etc/fstab.
#  - Make sure 'passworddir' is set in tsm.sys so that the passwd file
#    ends up in ${PKG_SYSCONFDIR} instead of the shadow hierarchy.
#  - The environment variables DSM_DIR, DSM_CONFIG, DSM_LOG 
#    need to be set properly. DSM_LOG may inadvertently end up in 
#    the emul shadow hierarchy.
#  - For backing up the native filesystem hierarchy, prefix paths with 
#    '/../', or use a construct like "ln -s / /.`hostname`" to break 
#    out of the emul shadow hierarchy.
#
# $NetBSD: tsm_daily.sh,v 1.1 2018/10/17 13:54:39 hauke Exp $

umask 027

# Adapt to your pkgsrc settings
SYSCONFDIR="%PKG_SYSCONFDIR%"
PREFIX="%PREFIX%"
VARBASE="%VARBASE%"

TSMCONFDIR="${SYSCONFDIR}"
TSMBINDIR="${PREFIX}/emul/linux/opt/tivoli/tsm/client/ba/bin"

DSM_DIR="${PREFIX}/emul/linux/opt/tivoli/tsm/client/ba/bin"
DSM_CONFIG="${TSMCONFDIR}/dsm.opt"
DSM_LOG="${VARBASE}/log"

export DSM_DIR DSM_CONFIG DSM_LOG 

# Check if the above settings are reasonable
if [ ! -d ${TSMCONFDIR} ]
then
    echo "TSM config directory ${TSMCONFDIR} does not exist, aborting." | logger
    exit 1
elif [ ! -f ${DSM_CONFIG} ]
then
    echo "TSM config file ${DSM_CONFIG} not found, aborting." | logger
    exit 1
fi

LC_CTYPE="en_US"
LC_ALL="en_US"
LANG="en_US"

export LC_CTYPE LC_ALL LANG


LOGNAME="dsm-runlog"

# Rotate the logs
for ii in 5 4 3 2 1 0
do
    if [ -f ${DSM_LOG}/${LOGNAME}.${ii} ]
    then
	mv ${DSM_LOG}/${LOGNAME}.${ii} ${DSM_LOG}/${LOGNAME}.$((${ii} + 1))
    fi
done

if [ -f ${DSM_LOG}/${LOGNAME} ]
then
    mv ${DSM_LOG}/${LOGNAME} ${DSM_LOG}/${LOGNAME}.0
fi

echo "DSM Daily Backup start: " `date` | logger

DSMC=${TSMBINDIR}/dsmc

${DSMC} incremental > ${DSM_LOG}/${LOGNAME} 2>&1

echo "DSM Daily Backup finished: " `date` | logger