diff --git a/.travis.yml b/.travis.yml index e89d4cb6bce..788f02d70ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -215,8 +215,3 @@ jobs: env: IMAGE=khos2ow/cloudstack-deb-builder:ubuntu1604 PARAMS="" <<: *package_job - - stage: package - services: docker - env: IMAGE=khos2ow/cloudstack-deb-builder:ubuntu1404 PARAMS="" - <<: *package_job - diff --git a/debian/cloudstack-agent.install b/debian/cloudstack-agent.install index 184d92282be..60f42378619 100644 --- a/debian/cloudstack-agent.install +++ b/debian/cloudstack-agent.install @@ -21,7 +21,6 @@ /etc/default/cloudstack-agent /etc/profile.d/cloudstack-agent-profile.sh /etc/logrotate.d/cloudstack-agent -/etc/init.d/cloudstack-agent /usr/bin/cloudstack-setup-agent /usr/bin/cloudstack-ssh /usr/bin/cloudstack-agent-upgrade diff --git a/debian/cloudstack-management.install b/debian/cloudstack-management.install index bb241fbec37..289a4957fad 100644 --- a/debian/cloudstack-management.install +++ b/debian/cloudstack-management.install @@ -22,7 +22,6 @@ /etc/cloudstack/management/java.security.ciphers /etc/cloudstack/management/log4j-cloud.xml /etc/default/cloudstack-management -/etc/init.d/cloudstack-management /etc/security/limits.d/cloudstack-limits.conf /etc/sudoers.d/cloudstack /var/cache/cloudstack/management diff --git a/debian/cloudstack-usage.install b/debian/cloudstack-usage.install index c0cc95a80b7..6fa9f6072af 100644 --- a/debian/cloudstack-usage.install +++ b/debian/cloudstack-usage.install @@ -17,6 +17,5 @@ /usr/share/cloudstack-usage/lib/* /usr/share/cloudstack-usage/plugins -/etc/init.d/cloudstack-usage /etc/cloudstack/usage/* /etc/default/cloudstack-usage diff --git a/debian/control b/debian/control index b444cfa4f44..2fc5af62749 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: cloudstack Section: libs Priority: extra Maintainer: Wido den Hollander -Build-Depends: debhelper (>= 9), openjdk-8-jdk | java8-sdk | java8-jdk, genisoimage, +Build-Depends: debhelper (>= 9), openjdk-8-jdk | java8-sdk | java8-jdk | openjdk-9-jdk, genisoimage, python-mysql.connector, maven (>= 3) | maven3, python (>= 2.7), lsb-release, dh-systemd, python-setuptools Standards-Version: 3.8.1 Homepage: http://www.cloudstack.org/ @@ -15,14 +15,14 @@ Description: A common package which contains files which are shared by several C Package: cloudstack-management Architecture: all -Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), sudo, jsvc, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, lsb-release, init-system-helpers (>= 1.14~) +Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), sudo, python-mysql.connector, libmysql-java, augeas-tools, mysql-client, adduser, bzip2, ipmitool, lsb-release, init-system-helpers (>= 1.14~) Conflicts: cloud-server, cloud-client, cloud-client-ui Description: CloudStack server library The CloudStack management server Package: cloudstack-agent Architecture: all -Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 1.2.2), uuid-runtime, iproute2, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release, init-system-helpers (>= 1.14~), aria2 +Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), lsb-base (>= 9), libcommons-daemon-java, openssh-client, qemu-kvm (>= 2.5), libvirt-bin (>= 1.3), uuid-runtime, iproute2, ebtables, vlan, ipset, python-libvirt, ethtool, iptables, lsb-release, aria2 Recommends: init-system-helpers Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts Description: CloudStack agent @@ -32,7 +32,7 @@ Description: CloudStack agent Package: cloudstack-usage Architecture: all -Depends: openjdk-8-jre-headless | java8-runtime-headless | java8-runtime, cloudstack-common (= ${source:Version}), jsvc, libmysql-java, init-system-helpers (>= 1.14~) +Depends: openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-9-jre-headless, cloudstack-common (= ${source:Version}), libmysql-java, init-system-helpers Description: CloudStack usage monitor The CloudStack usage monitor provides usage accounting across the entire cloud for cloud operators to charge based on usage parameters. diff --git a/debian/rules b/debian/rules index bac57ed3930..4ac524b5f4b 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,6 @@ override_dh_auto_clean: override_dh_auto_install: # Common packages mkdir -p $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE) - mkdir -p $(DESTDIR)/$(SYSCONFDIR)/init.d mkdir -p $(DESTDIR)/$(SYSCONFDIR)/default mkdir -p $(DESTDIR)/var/cache/$(PACKAGE) @@ -43,7 +42,6 @@ override_dh_auto_install: install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/ install -D plugins/hypervisors/kvm/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/ - install -m0755 packaging/debian/$(PACKAGE)-agent.init $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent install -d -m0755 debian/$(PACKAGE)-agent/lib/systemd/system # Fix libvirt service name for Debian/Ubuntu sed -i 's/Requires=libvirtd.service/Requires=libvirt-bin.service/g' packaging/systemd/$(PACKAGE)-agent.service @@ -85,7 +83,6 @@ override_dh_auto_install: mv $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/server/cloudstack-sudoers $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/$(PACKAGE) chmod 0440 $(DESTDIR)/$(SYSCONFDIR)/sudoers.d/$(PACKAGE) - install -D packaging/debian/init/cloud-management $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-management install -D client/target/utilities/bin/cloud-update-xenserver-licenses $(DESTDIR)/usr/bin/cloudstack-update-xenserver-licenses # Remove configuration in /ur/share/cloudstack-management/webapps/client/WEB-INF # This should all be in /etc/cloudstack/management @@ -130,7 +127,6 @@ override_dh_auto_install: cp usage/target/transformed/db.properties $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/ cp usage/target/transformed/log4j-cloud_usage.xml $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/log4j-cloud.xml - install -D -m0755 packaging/debian/$(PACKAGE)-usage.init $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage install -d -m0755 debian/$(PACKAGE)-usage/lib/systemd/system install -m0644 packaging/systemd/$(PACKAGE)-usage.service debian/$(PACKAGE)-usage/lib/systemd/system/$(PACKAGE)-usage.service install -m0644 packaging/systemd/$(PACKAGE)-usage.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-usage @@ -143,9 +139,6 @@ override_dh_auto_install: mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-integration-tests cp -r test/integration/* $(DESTDIR)/usr/share/$(PACKAGE)-integration-tests/ -override_dh_installinit: - dh_installinit -pcloudstack-management -pcloudstack-agent -pcloudstack-usage --onlyscripts --no-start - override_dh_systemd_enable: dh_systemd_enable -pcloudstack-management -pcloudstack-agent -pcloudstack-usage diff --git a/packaging/build-deb.sh b/packaging/build-deb.sh index e9d2399c0bf..c13fb60853f 100755 --- a/packaging/build-deb.sh +++ b/packaging/build-deb.sh @@ -21,13 +21,7 @@ set -e # # This script builds Debian packages for CloudStack and does # so by altering the debian/changelog file and add the Ubuntu -# version as a suffix, for example: 4.9.0~xenial -# -# To build packages for Ubuntu 14.04 run this script on a -# 14.04 system. The same goes for Ubuntu 16.04 -# -# The biggest difference between those two versions is the -# sysvinit vs systemd and Java 7 vs Java 8 +# version as a suffix, for example: 4.10.0~xenial # # These packages can be build using Docker for example: # @@ -36,9 +30,6 @@ set -e # Ubuntu 16.04 # docker run -ti -v /tmp:/src ubuntu:16.04 /bin/bash -c "apt-get update && apt-get install -y dpkg-dev python debhelper openjdk-8-jdk genisoimage python-mysql.connector maven lsb-release devscripts dh-systemd python-setuptools && /src/cloudstack/packaging/build-deb.sh" # -# Ubuntu 14.04 -# docker run -ti -v /tmp:/src ubuntu:14.04 /bin/bash -c "apt-get update && apt-get install -y dpkg-dev python debhelper openjdk-8-jdk genisoimage python-mysql.connector maven lsb-release devscripts dh-systemd python-setuptools && /src/cloudstack/packaging/build-deb.sh" -# function usage() { cat << USAGE diff --git a/packaging/debian/cloudstack-agent.init b/packaging/debian/cloudstack-agent.init deleted file mode 100755 index 26107792a6b..00000000000 --- a/packaging/debian/cloudstack-agent.init +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: cloudstack-agent -# Required-Start: $network $local_fs -# Required-Stop: $network $local_fs -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Start/stop Apache CloudStack Agent -# Description: This scripts Starts/Stops the Apache CloudStack agent -## The CloudStack Agent is a part of the Apache CloudStack project and is used -## for managing KVM-based Hypervisors and performing secondary storage tasks inside -## the Secondary Storage System Virtual Machine. -## JSVC (Java daemonizing) is used for starting and stopping the agent -### 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. - -. /lib/lsb/init-functions - -TMP=/usr/share/cloudstack-agent/tmp -SHORTNAME="cloudstack-agent" -PIDFILE=/var/run/"$SHORTNAME".pid -LOCKFILE=/var/lock/subsys/"$SHORTNAME" -PROGNAME="CloudStack Agent" -CLASS="com.cloud.agent.AgentShell" -PROG="jsvc" -DAEMON="/usr/bin/jsvc" -SHUTDOWN_WAIT="30" - -unset OPTIONS -[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME" - -# create java tmp dir if not found -mkdir -m 0755 -p "$TMP" - -# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT) -JDK_DIRS="/usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-8-openjdk-i386 /usr/lib/jvm/java-8-oracle" - -for jdir in $JDK_DIRS; do - if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then - JAVA_HOME="$jdir" - fi -done -export JAVA_HOME - -ACP=`ls /usr/share/cloudstack-agent/lib/*.jar | tr '\n' ':' | sed s'/.$//'` -PCP=`ls /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'` - -# We need to append the JSVC daemon JAR to the classpath -# AgentShell implements the JSVC daemon methods -export CLASSPATH="/usr/share/java/commons-daemon.jar:$ACP:$PCP:/etc/cloudstack/agent" - -wait_for_network() { - i=1 - while [ $i -lt 10 ] - do - # Under Ubuntu and Debian libvirt by default creates a bridge called virbr0. - # That's why we want more then 3 lines back from brctl, so that there is a manually created bridge - if [ "$(brctl show|wc -l)" -gt 2 ]; then - break - else - sleep 1 - let i=$i+1 - continue - fi - done -} - -start() { - if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then - log_daemon_msg "$PROGNAME apparently already running" - log_end_msg 0 - exit 0 - fi - - log_daemon_msg "Starting $PROGNAME" "$SHORTNAME" - if hostname --fqdn >/dev/null 2>&1 ; then - true - else - log_failure_msg "The host name does not resolve properly to an IP address. Cannot start $PROGNAME" - log_end_msg 1 - exit 1 - fi - - wait_for_network - - if start_daemon -p $PIDFILE $DAEMON -Djava.io.tmpdir="$TMP" -Xms256m -Xmx2048m -cp "$CLASSPATH" -Djna.nosys=true -pidfile "$PIDFILE" -errfile SYSLOG $CLASS - RETVAL=$? - then - rc=0 - sleep 1 - if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then - log_failure_msg "$PROG failed to start" - rc=1 - fi - else - rc=1 - fi - - if [ $rc -eq 0 ]; then - log_end_msg 0 - else - log_end_msg 1 - rm -f "$PIDFILE" - fi -} - -stop() { - count="0" - - log_daemon_msg "Stopping $PROGNAME" "$SHORTNAME" - killproc -p $PIDFILE $DAEMON - - until [ "$count" -gt "$SHUTDOWN_WAIT" ] - do - agentPid=$(ps aux|grep [j]svc|grep $SHORTNAME) - if [ "$?" -gt "0" ];then - break - fi - sleep 1 - let count="${count}+1" - done - - agentPid=$(ps aux|grep [j]svc|grep $SHORTNAME) - if [ "$?" -eq "0" ]; then - agentPid=$(ps aux|grep [j]svc|awk '{print $2}') - if [ "$agentPid" != "" ]; then - log_warning_msg "$PROG still running, forcing kill" - kill -9 $agentPid - fi - fi - - log_end_msg $? - rm -f "$PIDFILE" -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status_of_proc -p "$PIDFILE" "$PROG" "$SHORTNAME" - RETVAL=$? - ;; - restart | force-reload) - stop - sleep 3 - start - ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload|status}" - RETVAL=3 -esac - -exit $RETVAL diff --git a/packaging/debian/cloudstack-usage.init b/packaging/debian/cloudstack-usage.init deleted file mode 100755 index 05174504bef..00000000000 --- a/packaging/debian/cloudstack-usage.init +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: cloudstack-usage -# Required-Start: $network $local_fs -# Required-Stop: $network $local_fs -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Start/stop Apache CloudStack Usage Monitor -# Description: This scripts Starts/Stops the Apache CloudStack Usage Monitor -## The CloudStack Usage Monitor is a part of the Apache CloudStack project and is used -## for storing usage statistics from instances. -## JSVC (Java daemonizing) is used for starting and stopping the usage monitor. -### 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. - -. /lib/lsb/init-functions - -SHORTNAME="cloudstack-usage" -PIDFILE=/var/run/"$SHORTNAME".pid -PROGNAME="CloudStack Usage Monitor" -CLASS="com.cloud.usage.UsageServer" -PROG="jsvc" -DAEMON="/usr/bin/jsvc" - -unset OPTIONS -[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME" - -setJavaHome() { - # use $JAVA_HOME if defined - if [ -n "$JAVA_HOME" ] ; then - return - fi - - # try java first - java=$(which java 2>/dev/null || :) - - # try javac if java is not found - if [ -z "$java" ] ; then - java=$(which javac 2>/dev/null || :) - fi - - if [ -n "$java" ] ; then - JAVA_HOME=$(dirname $(dirname $(readlink -e $java))) - export JAVA_HOME - return - fi - - # If everything has failed, try hardcoded paths - # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT) - JDK_DIRS="/usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-8-openjdk-i386 /usr/lib/jvm/java-8-oracle /usr/lib/jvm/java-8-openjdk" - for jdir in $JDK_DIRS; do - if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then - JAVA_HOME="$jdir" - export JAVA_HOME - return - fi - done - - # didnt find java home. exiting with error - exit 1 -} - -setJavaHome - -UCP=`ls /usr/share/cloudstack-usage/lib/*.jar | tr '\n' ':' | sed s'/.$//'` -PCP=`ls /usr/share/cloudstack-usage/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'` - -# We need to append the JSVC daemon JAR to the classpath -# AgentShell implements the JSVC daemon methods -export CLASSPATH="/usr/share/java/commons-daemon.jar:/usr/share/java/mysql-connector-java.jar:$UCP:$PCP:/etc/cloudstack/usage" - -start() { - if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then - log_daemon_msg "$PROGNAME apparently already running" - log_end_msg 0 - exit 0 - fi - - log_daemon_msg "Starting $PROGNAME" "$SHORTNAME" - if hostname --fqdn >/dev/null 2>&1 ; then - true - else - log_failure_msg "The host name does not resolve properly to an IP address. Cannot start $PROGNAME" - log_end_msg 1 - exit 1 - fi - - if start_daemon -p $PIDFILE $DAEMON -home "$JAVA_HOME" -cp "$CLASSPATH" -pidfile "$PIDFILE" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS - RETVAL=$? - then - rc=0 - sleep 1 - if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then - log_failure_msg "$PROG failed to start" - rc=1 - fi - else - rc=1 - fi - - if [ $rc -eq 0 ]; then - log_end_msg 0 - else - log_end_msg 1 - rm -f "$PIDFILE" - fi -} - -stop() { - log_daemon_msg "Stopping $PROGNAME" "$SHORTNAME" - killproc -p $PIDFILE $DAEMON - log_end_msg $? - rm -f "$PIDFILE" -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status_of_proc -p "$PIDFILE" "$PROG" "$SHORTNAME" - RETVAL=$? - ;; - restart | force-reload) - stop - sleep 3 - start - ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload|status}" - RETVAL=3 -esac - -exit $RETVAL diff --git a/packaging/debian/init/cloud-management b/packaging/debian/init/cloud-management deleted file mode 100755 index 580f683b829..00000000000 --- a/packaging/debian/init/cloud-management +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/sh -# -# /etc/init.d/cloudstack-management -- startup script for CloudStack - -# 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. -### BEGIN INIT INFO -# Provides: cloudstack-management -# Required-Start: $local_fs $remote_fs $network -# Required-Stop: $local_fs $remote_fs $network -# Should-Start: $named -# Should-Stop: $named -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start CloudStack. -# Description: Start the CloudStack Management Server. -### END INIT INFO - -PATH=/bin:/usr/bin:/sbin:/usr/sbin -NAME=cloudstack-management -DESC="CloudStack Management Server" -DAEMON=/usr/bin/jsvc -DEFAULT=/etc/default/$NAME -USER="cloud" -GROUP="cloud" -CLOUDSTACK_PID="/var/run/$NAME.pid" - -# We have to explicitly set the HOME variable to the homedir from the user "cloud" -# This is because various scripts run by the management server read the HOME variable -# and fail when this init script is run manually. -HOME=$(echo ~cloud) - -if [ `id -u` -ne 0 ]; then - echo "You need root privileges to run this script" - exit 1 -fi - -if [ -r /etc/default/locale ]; then - . /etc/default/locale - export LANG -fi - -. /lib/lsb/init-functions -. /etc/default/rcS - -# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not -# defined in $DEFAULT) -JDK_DIRS="/usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/java-8-openjdk-i386 /usr/lib/jvm/java-8-oracle /usr/lib/jvm/java-8-openjdk" - -# Look for the right JVM to use -for jdir in $JDK_DIRS; do - if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then - JAVA_HOME="$jdir" - fi -done -export JAVA_HOME - -# overwrite settings from default file -if [ -f "$DEFAULT" ]; then - . "$DEFAULT" -fi - -JARS=$(ls /usr/share/cloudstack-management/lib/*.jar | tr '\n' ':' | sed s'/.$//') -CLASSPATH="$JARS:$CLASSPATH" - -[ -f "$DAEMON" ] || exit 0 - -# Look for Java Secure Sockets Extension (JSSE) JARs -if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then - JSSE_HOME="${JAVA_HOME}/jre/" -fi -export JSSE_HOME - -case "$1" in - start) - if [ -z "$JAVA_HOME" ]; then - log_failure_msg "no JDK found - please set JAVA_HOME" - exit 1 - fi - - log_daemon_msg "Starting $DESC" "$NAME" - if start-stop-daemon --test --start --quiet --pidfile "$CLOUDSTACK_PID" \ - --user $USER --startas "$JAVA_HOME/bin/java"; then - - # fix storage issues on nfs mounts - umask 000 - start-stop-daemon --start --quiet --pidfile "$CLOUDSTACK_PID" \ - --user $USER --group $GROUP --exec $DAEMON -- -user "$USER" -server \ - -home "$JAVA_HOME" -cp "$CLASSPATH" \ - -outfile SYSLOG -errfile $LOGDIR/$NAME.err \ - -pidfile "$CLOUDSTACK_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS" - log_end_msg $? - else - log_progress_msg "(already running)" - log_end_msg 0 - fi - ;; - stop) - log_daemon_msg "Stopping $DESC" "$NAME" - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile "$CLOUDSTACK_PID" - RETVAL="$?" - [ "$RETVAL" = 2 ] && return 2 - log_end_msg 0 - ;; - status) - if start-stop-daemon --test --start --pidfile "$CLOUDSTACK_PID" \ - --user $USER --startas "$JAVA_HOME/bin/java" \ - >/dev/null; then - - if [ -f "$CLOUDSTACK_PID" ]; then - log_success_msg "$DESC is not running, but pid file exists." - exit 1 - else - log_success_msg "$DESC is not running." - exit 3 - fi - else - log_success_msg "$DESC is running with pid `cat $CLOUDSTACK_PID`" - fi - ;; - restart|force-reload) - if start-stop-daemon --test --stop --pidfile "$CLOUDSTACK_PID" \ - --user $USER --startas "$JAVA_HOME/bin/java" \ - >/dev/null; then - $0 stop - sleep 1 - fi - $0 start - ;; - *) - log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" - exit 1 - ;; -esac - -exit 0