3 # $FreeBSD: head/databases/cego/files/cego.in 340872 2014-01-24 00:14:07Z mat $
7 # REQUIRE: LOGIN cleanvar
11 # Add the following lines to /etc/rc.conf to enable cego:
12 # cego_enable (bool): Set to "NO" by default.
13 # Set it to "YES" to enable cego
14 # cego_profiles (str): Set to "" by default.
15 # Define your profiles here.
16 # cego_tablespc (str): Set it to the tablespace
17 # cego_flags (str): Set to "" by default.
18 # Extra flags passed to start command.
25 command="%%PREFIX%%/bin/cego"
28 : ${cego_conf="%%PREFIX%%/cego"}
29 : ${cego_root="%%PREFIX%%/cego"}
30 : ${cego_user="%%USER%%"}
34 _pidprefix="/var/run/cego"
35 pidfile="${_pidprefix}.pid"
37 command_arg="--mode=daemon"
38 _pidprefix="/var/run/cego"
46 if [ "x${cego_profiles}" != "x" ]; then
47 pidfile="${_pidprefix}.${profile}.pid"
49 echo profile is $profile
51 eval cego_tablespc="\${cego_${profile}_tablespc:-}"
52 if [ "x${cego_tablespc}" = "x" ]; then
53 err 1 "You must define a tableset for db instance cego_${profile}_tablespc"
56 eval cego_conf="\${cego_${profile}_conf:-${cego_conf}}"
57 eval cego_root="\${cego_${profile}_root:-${cego_root}}"
59 required_files="${cego_conf}/${profile}.xml"
60 eval cego_enable="\${cego_${profile}_enable:-${cego_enable}}"
61 command_args="--dbxml=${required_files} --tableset=${cego_tablespc} --lockfile=${cego_root}/${profile}.lck --logfile=${cego_root}/${profile}.log"
62 echo "Setting command_args $command_args"
64 warn "$0: extra argument ignored"
67 if [ "x${cego_profiles}" != "x" -a "x$1" != "x" ]; then
68 for profile in ${cego_profiles}; do
69 eval _enable="\${cego_${profile}_enable}"
70 case "x${_enable:-${cego_enable}}" in
71 x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
77 if test -z "$_enable"; then
80 _var=cego_"${profile}"_enable
83 "'${_enable:-${cego_enable}}'" \
85 "Profile ${profile} skipped."
89 echo "===> cego profile: ${profile}"
90 %%PREFIX%%/etc/rc.d/cego $1 ${profile}
92 if [ "0${retcode}" -ne 0 ]; then
93 failed="${profile} (${retcode}) ${failed:-}"
95 success="${profile} ${success:-}"
103 cego_requirepidfile()
105 if [ ! "0`check_pidfile ${pidfile} ${command}`" -gt 1 ]; then
106 err 1 "${name} not running? (check $pidfile)."