/
bareos-ctl-fd.in
executable file
·101 lines (82 loc) · 2.5 KB
/
bareos-ctl-fd.in
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#! /bin/sh
#
# bareos-ctl-fd This shell script takes care of starting and stopping
# the bareos File daemon.
#
# This is pretty much watered down version of the RedHat script
# that works on Solaris as well as Linux, but it won't work everywhere.
#
# description: Backup Archiving REcovery Open Sourced.
#
PSCMD="@PSCMD@"
PS="ps"
#
# On Solaris, you may need to use nawk, or alternatively,
# add the GNU binaries to your path, such as /usr/xpg4/bin
#
AWK=@AWK@
# All these are not *really* needed but it makes it
# easier to "steal" this code for the development
# environment where they are different.
#
BAREOS_FILEDAEMON_BINARY=${BAREOS_FILEDAEMON_BINARY:-@sbindir@/bareos-fd}
PIDDIR=${PIDDIR:-@piddir@}
SUBSYSDIR=@subsysdir@
BAREOS_CONFIG_DIR=${BAREOS_CONFIG_DIR:-@confdir@}
BAREOS_FD_PORT=${BAREOS_FD_PORT:-@fd_port@}
BAREOS_FD_USER=${BAREOS_FD_USER:-@fd_user@}
BAREOS_FD_GROUP=${BAREOS_FD_GROUP:-@fd_group@}
Bareos="@BAREOS@"
PIDOF="@PIDOF@"
PGREP="@PGREP@"
OS=`uname -s`
#
# Source the generic functions.
#
. @scriptdir@/bareos-ctl-funcs
# if /lib/tls exists, force Bareos to use the glibc pthreads instead
if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
export LD_ASSUME_KERNEL=2.4.19
fi
case "$1" in
start)
if [ -x ${BAREOS_FILEDAEMON_BINARY} ]; then
echo "Starting the $Bareos File daemon"
OPTIONS=''
if [ "${BAREOS_FD_USER}" != '' ]; then
OPTIONS="${OPTIONS} -u ${BAREOS_FD_USER}"
fi
if [ "${BAREOS_FD_GROUP}" != '' ]; then
OPTIONS="${OPTIONS} -g ${BAREOS_FD_GROUP}"
fi
if [ "${BAREOS_CONFIG_DIR}" != '' ]; then
OPTIONS="${OPTIONS} -c ${BAREOS_CONFIG_DIR}"
fi
if [ "x${VALGRIND_FD}" = "x1" ]; then
valgrind --leak-check=full ${BAREOS_FILEDAEMON_BINARY} -v $2 $3 ${OPTIONS}
else
${BAREOS_FILEDAEMON_BINARY} -v $2 $3 ${OPTIONS}
fi
fi
;;
stop)
if [ -x ${BAREOS_FILEDAEMON_BINARY} ]; then
echo "Stopping the $Bareos File daemon"
killproc ${BAREOS_FILEDAEMON_BINARY} ${BAREOS_FD_PORT}
fi
;;
restart)
$0 stop
sleep 5
$0 start
;;
status)
[ -x ${BAREOS_FILEDAEMON_BINARY} ] && status ${BAREOS_FILEDAEMON_BINARY} ${BAREOS_FD_PORT}
exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0