
- Add a new element 'guest-agent' for image building. This element is used when dev_mode=false, so that the trove code is downloaded into the image during the building phase rather than during the guest agent initialization. - Improve trovestack sub-command 'build-image'. ./trovestack build-image ${datastore_type} \ ${guest_os} \ ${guest_release} \ ${dev_mode} - Improve documentation. Story: #2005387 Task: #30375 Change-Id: I9d7acbd6a97f8c01b48b0f2cf94398d549d89124
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
### BEGIN INIT INFO
|
|
# Provides: guest-agent
|
|
# Required-Start: $remote_fs $syslog $network
|
|
# Required-Stop: $remote_fs $syslog $network
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Runs the Trove Guest Agent processes
|
|
# Description: This script runs Trove Guest Agent processes.
|
|
# This script will start the Guest Agent services
|
|
# and kill them.
|
|
### END INIT INFO
|
|
|
|
# Using the lsb functions to perform the operations.
|
|
. /lib/lsb/init-functions
|
|
# Process name ( For display )
|
|
NAME=guest-agent
|
|
# Daemon name, where is the actual executable
|
|
DAEMON=/usr/local/bin/guest-agent
|
|
# pid file for the daemon
|
|
PIDFILE=/var/run/guest-agent.pid
|
|
|
|
# If the daemon is not there, then exit.
|
|
test -x $DAEMON || exit 5
|
|
|
|
case $1 in
|
|
start)
|
|
# Checked the PID file exists and check the actual status of process
|
|
if [ -e $PIDFILE ]; then
|
|
status_of_proc -p $PIDFILE $DAEMON "$NAME process" && status="0" || status="$?"
|
|
# If the status is SUCCESS then don't need to start again.
|
|
if [ $status = "0" ]; then
|
|
exit # Exit
|
|
fi
|
|
fi
|
|
# Start the daemon.
|
|
log_daemon_msg "Starting the process" "$NAME"
|
|
# Start the daemon with the help of start-stop-daemon
|
|
# Log the message appropriately
|
|
if start-stop-daemon --start -m --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- --config-file /etc/octavia/guest-agent.conf ; then
|
|
log_end_msg 0
|
|
else
|
|
log_end_msg 1
|
|
fi
|
|
;;
|
|
stop)
|
|
# Stop the daemon.
|
|
if [ -e $PIDFILE ]; then
|
|
status_of_proc -p $PIDFILE $DAEMON "Stopping the $NAME process" && status="0" || status="$?"
|
|
if [ "$status" = 0 ]; then
|
|
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
|
|
/bin/rm -rf $PIDFILE
|
|
fi
|
|
else
|
|
log_daemon_msg "$NAME process is not running"
|
|
log_end_msg 0
|
|
fi
|
|
;;
|
|
restart)
|
|
# Restart the daemon.
|
|
$0 stop && sleep 2 && $0 start
|
|
;;
|
|
*)
|
|
# For invalid arguments, print the usage message.
|
|
echo "Usage: $0 {start|stop|restart|reload|status}"
|
|
exit 2
|
|
;;
|
|
esac
|