You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2017/08/14 13:46:03 UTC
[cloudstack] 02/02: Start services after enabling them using systemd
This is an automated email from the ASF dual-hosted git repository.
widodh pushed a commit to branch debian9-systemvmtemplate
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit ac2d47421fbccd9cd12847333b5c68e7b25826bd
Author: Wido den Hollander <wi...@widodh.nl>
AuthorDate: Mon Aug 14 15:01:21 2017 +0200
Start services after enabling them using systemd
In addition remove /etc/init.d/cloud as this is no longer needed and done by systemd
Signed-off-by: Wido den Hollander <wi...@widodh.nl>
---
systemvm/patches/debian/config/etc/init.d/cloud | 155 ---------------------
.../debian/config/etc/init.d/cloud-early-config | 22 ++-
2 files changed, 8 insertions(+), 169 deletions(-)
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud b/systemvm/patches/debian/config/etc/init.d/cloud
deleted file mode 100755
index 9b3a63b..0000000
--- a/systemvm/patches/debian/config/etc/init.d/cloud
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides: cloud
-# Required-Start: $local_fs cloud-early-config
-# Required-Stop: $local_fs
-# Default-Start: 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Start up the CloudStack cloud service
-### END INIT INFO
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#set -x
-
-ENABLED=0
-[ -e /etc/default/cloud ] && . /etc/default/cloud
-
-CMDLINE=$(cat /var/cache/cloud/cmdline)
-
-if [ ! -z $CLOUD_DEBUG ];then
- LOG_FILE=/var/log/cloud/cloud.out
-else
- LOG_FILE=/dev/null
-fi
-
-TYPE="router"
-for i in $CMDLINE
- do
- # search for foo=bar pattern and cut out foo
- FIRSTPATTERN=$(echo $i | cut -d= -f1)
- case $FIRSTPATTERN in
- type)
- TYPE=$(echo $i | cut -d= -f2)
- ;;
- esac
-done
-
-# Source function library.
-if [ -f /etc/init.d/functions ]
-then
- . /etc/init.d/functions
-fi
-
-if [ -f ./lib/lsb/init-functions ]
-then
- . /lib/lsb/init-functions
-fi
-
-_success() {
- if [ -f /etc/init.d/functions ]
- then
- success
- else
- echo "Success"
- fi
-}
-
-_failure() {
- if [ -f /etc/init.d/functions ]
- then
- failure
- else
- echo "Failed"
- fi
-}
-RETVAL=$?
-CLOUDSTACK_HOME="/usr/local/cloud"
-if [ -f $CLOUDSTACK_HOME/systemvm/utils.sh ];
-then
- . $CLOUDSTACK_HOME/systemvm/utils.sh
-else
- _failure
-fi
-
-# mkdir -p /var/log/vmops
-
-start() {
- local pid=$(get_pids)
- if [ "$pid" != "" ]; then
- echo "CloudStack cloud sevice is already running, PID = $pid"
- return 0
- fi
-
- echo -n "Starting CloudStack cloud service (type=$TYPE) "
- if [ -f $CLOUDSTACK_HOME/systemvm/run.sh ];
- then
- if [ "$pid" == "" ]
- then
- (cd $CLOUDSTACK_HOME/systemvm; nohup ./run.sh > $LOG_FILE 2>&1 & )
- pid=$(get_pids)
- echo $pid > /var/run/cloud.pid
- fi
- _success
- else
- _failure
- fi
- echo
- echo 'start' > $CLOUDSTACK_HOME/systemvm/user_request
-}
-
-stop() {
- local pid
- echo -n "Stopping CloudStack cloud service (type=$TYPE): "
- for pid in $(get_pids)
- do
- kill $pid
- done
- _success
- echo
- echo 'stop' > $CLOUDSTACK_HOME/systemvm/user_request
-}
-
-status() {
- local pids=$(get_pids)
- if [ "$pids" == "" ]
- then
- echo "CloudStack cloud service is not running"
- return 1
- fi
- echo "CloudStack cloud service (type=$TYPE) is running: process id: $pids"
- return 0
-}
-
-[ "$ENABLED" != 0 ] || exit 0
-
-case "$1" in
- start) start
- ;;
- stop) stop
- ;;
- status) status
- ;;
- restart) stop
- start
- ;;
- *) echo "Usage: $0 {start|stop|status|restart}"
- exit 1
- ;;
-esac
-
-exit $RETVAL
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
index 655266c..6eaed91 100755
--- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config
+++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
@@ -497,16 +497,6 @@ disable_rpfilter_domR() {
echo "1" > /proc/sys/net/ipv4/conf/lo/rp_filter
}
-enable_svc() {
- local svc=$1
- local enabled=$2
-
- log_it "Enable service ${svc} = $enabled"
- local cfg=/etc/default/${svc}
- [ -f $cfg ] && sed -i "s/ENABLED=.*$/ENABLED=$enabled/" $cfg && return
-}
-
-
enable_irqbalance() {
local enabled=$1
local proc=0
@@ -803,6 +793,7 @@ setup_sshd(){
[ -f /etc/ssh/sshd_config ] && sed -i -e "s/^[#]*ListenAddress.*$/ListenAddress $ip/" /etc/ssh/sshd_config
sed -i "/3922/s/eth./$eth/" /etc/iptables/rules.v4
sed -i "/3922/s/eth./$eth/" /etc/iptables/rules
+ systemctl restart sshd
}
@@ -936,6 +927,7 @@ setup_router() {
systemctl enable dnsmasq haproxy cloud-passwd-srvr
+ systemctl restart dnsmasq haproxy cloud-passwd-srvr
enable_irqbalance 1
disable_rpfilter_domR
enable_fwding 1
@@ -1055,6 +1047,8 @@ EOF
fi
load_modules
+ systemctl restart dnsmasq haproxy cloud-passwd-srvr
+
#setup hourly logrotate
mv -n /etc/cron.daily/logrotate /etc/cron.hourly 2>&1
@@ -1073,6 +1067,7 @@ setup_dhcpsrvr() {
[ $ETH0_IP6 ] && echo "$ETH0_IP6 $NAME" >> /etc/hosts
systemctl enable dnsmasq cloud-passwd-srvr
+ systemctl restart dnsmasq cloud-passwd-srvr
enable_irqbalance 0
enable_fwding 0
systemctl disable nfs-common
@@ -1147,7 +1142,7 @@ setup_ntp() {
fi
sed -i "0,/^server/s//$PATTERN\nserver/" $NTP_CONF_FILE
done
- service ntp restart
+ systemctl restart ntp
else
log_it "NTP configuration file not found"
fi
@@ -1195,12 +1190,11 @@ Header always set Access-Control-Allow-Methods "POST, OPTIONS"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token, x-signature, x-metadata, x-expires"
CORS
- service apache2 restart
-
disable_rpfilter
enable_fwding 0
systemctl disable haproxy dnsmasq cloud-passwd-srvr
- systemctl enable cloud
+ systemctl enable cloud apache2
+ systemctl restart cloud apache2
enable_irqbalance 0
rm /etc/logrotate.d/cloud
setup_ntp
--
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>.