6cfd9681b7
This allows openstack services to be git/pip installed without installing any startup scripts. This is useful for keystone-db or nova-db elements, for example, where the service must be installed to perform database migration, but no service start scripts need be installed. Additionally, add a tool to create openstack sql databases. Use openstack pypi mirror: Use the openstack pypi mirror for openstack service installation. It's much faster than pypi.org. Also, pip install $svc_repo/tools/pip-requires first, if it exists, which is required to pick up oslo.config. Change-Id: I72751d4da59f8597d20aea2f27a9dfabe2f63a8f
33 lines
571 B
Bash
Executable File
33 lines
571 B
Bash
Executable File
#!/bin/bash
|
|
set -eu
|
|
|
|
|
|
function install_upstart {
|
|
local name=$1
|
|
local user=$2
|
|
local cmd=$3
|
|
shift; shift; shift
|
|
local args=$*
|
|
cat > /etc/init/$name.conf <<EOF
|
|
start on runlevel [2345]
|
|
stop on runlevel [016]
|
|
|
|
pre-start script
|
|
mkdir -p /var/run/$user
|
|
chown -R $user:$user /var/run/$user
|
|
end script
|
|
|
|
respawn
|
|
exec sudo -u $user $cmd $args
|
|
EOF
|
|
}
|
|
|
|
if [ $# -lt 4 ]; then
|
|
echo "Usage: os-svc-daemon DAEMON_NAME USER COMMAND [ARG[ARG[...]]]"
|
|
exit 1
|
|
fi
|
|
|
|
# TODO: check what system we are on, and install
|
|
# systemv instead, if appropriate.
|
|
install_upstart $*
|