Skip to content

Commit

Permalink
use RUNDIR and create config in RUNDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Jan 3, 2012
1 parent 301a7c9 commit 857026f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mxvipctl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CMD_IP="/sbin/ip"
CMD_IPTABLES="/usr/sbin/iptables"
CMD_MXS2MXVIP="/usr/sbin/mxstartup2mxvipcfg"

RUNDIR="/run/mariux"

# expands *-pattern in pathnames to null if no matching files are found..
shopt -s nullglob

Expand Down Expand Up @@ -118,7 +120,7 @@ function mxvip_start() {

: ${pattern:=*}

for vip in /run/mariux/mxvip.${pattern}.cfg ; do
for vip in ${RUNDIR}/mxvip.${pattern}.cfg ; do
if [ -e ${vip}.r ] ; then
echo >&2 "skipping $vip: already running.."
continue
Expand All @@ -145,7 +147,7 @@ function mxvip_stop() {

: ${pattern:=*}

for vip in /run/mariux/mxvip.${pattern}.cfg.r ; do
for vip in ${RUNDIR}/mxvip.${pattern}.cfg.r ; do
if [ ! -r ${vip} ] ; then
echo >&2 "skipping $vip: can't read file"
continue
Expand All @@ -163,20 +165,18 @@ function mxvip_stop() {


function create_run_dir_if_not_exists() {
local rundir="/run/mariux"

if [ ! -d $rundir ] ; then
mkdir -m 0700 $rundir
mkdir -m 0700 ${RUNDIR}
fi

if [ ! -O $rundir ] ; then
echo >&2 "$rundir: wrong owner: possible hack attempt? exiting.."
echo >&2 "${RUNDIR}: wrong owner: possible hack attempt? exiting.."
exit 1
fi
}

function create_mxvip() {
${CMD_MXS2MXVIP} >/dev/null
${CMD_MXS2MXVIP} ${RUNDIR} >/dev/null
}


Expand Down

0 comments on commit 857026f

Please sign in to comment.