File: bareos-ctl-sd.in

package info (click to toggle)
bareos 14.2.1%2B20141017gitc6c5b56-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 21,136 kB
  • sloc: ansic: 192,574; sh: 16,581; cpp: 15,290; makefile: 3,625; sql: 3,289; python: 768; lisp: 721; perl: 156; xml: 57; sed: 45; awk: 8
file content (94 lines) | stat: -rw-r--r-- 2,024 bytes parent folder | download | duplicates (2)
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
#! /bin/sh
#
# bareos-ctl-sd This shell script takes care of starting and stopping
#		the bareos Storage 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.
#
BACSDBIN=@sbindir@
BACSDCFG=@sysconfdir@
PIDDIR=@piddir@
SUBSYSDIR=@subsysdir@

SD_PORT=@sd_port@

SD_USER=@sd_user@
SD_GROUP=@sd_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)
      [ -x ${BACSDBIN}/bareos-sd ] && {
	 echo "Starting the $Bareos Storage daemon"
	 OPTIONS=''
	 if [ "${SD_USER}" != '' ]; then
	    OPTIONS="${OPTIONS} -u ${SD_USER}"
	 fi

	 if [ "${SD_GROUP}" != '' ]; then
	    OPTIONS="${OPTIONS} -g ${SD_GROUP}"
	 fi

	 if [ "x${VALGRIND_SD}" = "x1" ]; then
	    valgrind --leak-check=full ${BACSDBIN}/bareos-sd $2 $3 ${OPTIONS} -v -c ${BACSDCFG}/bareos-sd.conf
	 else
	    ${BACSDBIN}/bareos-sd $2 $3 ${OPTIONS} -v -c ${BACSDCFG}/bareos-sd.conf
	 fi
      }
      ;;


   stop)
      [ -x ${BACSDBIN}/bareos-sd ] && {
	 echo "Stopping the $Bareos Storage daemon"
	 killproc ${BACSDBIN}/bareos-sd ${SD_PORT}
      }
      ;;

   restart)
      $0 stop
      sleep 5
      $0 start
      ;;

   status)
      [ -x ${BACSDBIN}/bareos-sd   ] && status ${BACSDBIN}/bareos-sd  ${SD_PORT}
      ;;

   *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1
      ;;
esac
exit 0