mirror of
https://github.com/OpenNebula/one.git
synced 2025-07-11 16:58:58 +03:00
Fixing whitespace for one script
This commit is contained in:
@ -45,44 +45,44 @@ setup()
|
|||||||
PORT=$(sed -n '/^[ \t]*PORT/s/^.*PORT\s*=\s*\([0-9]\+\)\s*.*$/\1/p' \
|
PORT=$(sed -n '/^[ \t]*PORT/s/^.*PORT\s*=\s*\([0-9]\+\)\s*.*$/\1/p' \
|
||||||
$ONE_CONF)
|
$ONE_CONF)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Can not find PORT in $ONE_CONF."
|
echo "Can not find PORT in $ONE_CONF."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $LOCK_FILE ]; then
|
if [ -f $LOCK_FILE ]; then
|
||||||
if [ -f $ONE_PID ]; then
|
if [ -f $ONE_PID ]; then
|
||||||
ONEPID=`cat $ONE_PID`
|
ONEPID=`cat $ONE_PID`
|
||||||
ps $ONEPID > /dev/null 2>&1
|
ps $ONEPID > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "ONE is still running (PID:$ONEPID). Please try 'one stop' first."
|
echo "ONE is still running (PID:$ONEPID). Please try 'one stop' first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -f $ONE_SCHEDPID ]; then
|
if [ -f $ONE_SCHEDPID ]; then
|
||||||
ONESCHEDPID=`cat $ONE_SCHEDPID`
|
ONESCHEDPID=`cat $ONE_SCHEDPID`
|
||||||
ps $ONESCHEDPID > /dev/null 2>&1
|
ps $ONESCHEDPID > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "The scheduler is still running (PID:$ONEPID). Please try 'one stop' first."
|
echo "The scheduler is still running (PID:$ONEPID). Please try 'one stop' first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "Stale .lock detected. Erasing it."
|
echo "Stale .lock detected. Erasing it."
|
||||||
rm $LOCK_FILE
|
rm $LOCK_FILE
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
if [ ! -x "$ONED" ]; then
|
if [ ! -x "$ONED" ]; then
|
||||||
echo "Can not find $ONED."
|
echo "Can not find $ONED."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -x "$ONE_SCHEDULER" ]; then
|
if [ ! -x "$ONE_SCHEDULER" ]; then
|
||||||
echo "Can not find $ONE_SCHEDULER."
|
echo "Can not find $ONE_SCHEDULER."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$ONE_DB" ]; then
|
if [ ! -f "$ONE_DB" ]; then
|
||||||
if [ ! -f "$HOME/.one/one_auth" ]; then
|
if [ ! -f "$HOME/.one/one_auth" ]; then
|
||||||
@ -101,28 +101,28 @@ start()
|
|||||||
[ -f "$ONE_LOG" ] && cp $ONE_LOG{,.$(date '+%Y%m%d%H%M')}
|
[ -f "$ONE_LOG" ] && cp $ONE_LOG{,.$(date '+%Y%m%d%H%M')}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the one daemon
|
# Start the one daemon
|
||||||
$ONED -f 2>&1 &
|
$ONED -f 2>&1 &
|
||||||
|
|
||||||
LASTRC=$?
|
LASTRC=$?
|
||||||
LASTPID=$!
|
LASTPID=$!
|
||||||
|
|
||||||
if [ $LASTRC -ne 0 ]; then
|
if [ $LASTRC -ne 0 ]; then
|
||||||
echo "Error executing $ONED"
|
echo "Error executing $ONED"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo $LASTPID > $ONE_PID
|
echo $LASTPID > $ONE_PID
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
ps $LASTPID > /dev/null 2>&1
|
ps $LASTPID > /dev/null 2>&1
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error executing $ONED."
|
echo "Error executing $ONED."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the scheduler
|
# Start the scheduler
|
||||||
# The following command line arguments are supported by mm_shed:
|
# The following command line arguments are supported by mm_shed:
|
||||||
# [-p port] to connect to oned - default: 2633
|
# [-p port] to connect to oned - default: 2633
|
||||||
# [-t timer] seconds between two scheduling actions - default: 30
|
# [-t timer] seconds between two scheduling actions - default: 30
|
||||||
@ -133,19 +133,19 @@ start()
|
|||||||
# [-h host dispatch] max number of VMs dispatched to a given host in each
|
# [-h host dispatch] max number of VMs dispatched to a given host in each
|
||||||
# scheduling action - default: 1
|
# scheduling action - default: 1
|
||||||
|
|
||||||
$ONE_SCHEDULER -p $PORT -t 30 -m 300 -d 30 -h 1&
|
$ONE_SCHEDULER -p $PORT -t 30 -m 300 -d 30 -h 1&
|
||||||
|
|
||||||
LASTRC=$?
|
LASTRC=$?
|
||||||
LASTPID=$!
|
LASTPID=$!
|
||||||
|
|
||||||
if [ $LASTRC -ne 0 ]; then
|
if [ $LASTRC -ne 0 ]; then
|
||||||
echo "Error executing $ONE_SCHEDULER"
|
echo "Error executing $ONE_SCHEDULER"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo $LASTPID > $ONE_SCHEDPID
|
echo $LASTPID > $ONE_SCHEDPID
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "oned and scheduler started"
|
echo "oned and scheduler started"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -153,30 +153,30 @@ start()
|
|||||||
#
|
#
|
||||||
stop()
|
stop()
|
||||||
{
|
{
|
||||||
if [ ! -f $ONE_PID ]; then
|
if [ ! -f $ONE_PID ]; then
|
||||||
echo "Couldn't find oned process pid."
|
echo "Couldn't find oned process pid."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f $ONE_SCHEDPID ]; then
|
if [ ! -f $ONE_SCHEDPID ]; then
|
||||||
echo "Couldn't find scheduler process pid."
|
echo "Couldn't find scheduler process pid."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Kill the one daemon
|
# Kill the one daemon
|
||||||
|
|
||||||
kill `cat $ONE_PID` > /dev/null 2>&1
|
kill `cat $ONE_PID` > /dev/null 2>&1
|
||||||
|
|
||||||
# Kill the scheduler
|
# Kill the scheduler
|
||||||
|
|
||||||
kill `cat $ONE_SCHEDPID` > /dev/null 2>&1
|
kill `cat $ONE_SCHEDPID` > /dev/null 2>&1
|
||||||
|
|
||||||
# Remove pid files
|
# Remove pid files
|
||||||
|
|
||||||
rm -f $ONE_PID > /dev/null 2>&1
|
rm -f $ONE_PID > /dev/null 2>&1
|
||||||
rm -f $ONE_SCHEDPID > /dev/null 2>&1
|
rm -f $ONE_SCHEDPID > /dev/null 2>&1
|
||||||
|
|
||||||
echo "oned and scheduler stopped"
|
echo "oned and scheduler stopped"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = "-b" ]; then
|
if [ "$1" = "-b" ]; then
|
||||||
@ -185,18 +185,18 @@ if [ "$1" = "-b" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
setup
|
setup
|
||||||
start
|
start
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stop
|
stop
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: one [-b] {start|stop}" >&2
|
echo "Usage: one [-b] {start|stop}" >&2
|
||||||
echo "Options:" >&2
|
echo "Options:" >&2
|
||||||
echo " -b Backup log file." >&2
|
echo " -b Backup log file." >&2
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user