Merge pull request #2019 from influxdb/init_script_fixes

Remove obsolete packaging-related files
pull/2004/head
Philip O'Toole 2015-03-19 13:13:20 -07:00
commit e3be4fa98d
3 changed files with 0 additions and 284 deletions

View File

@ -1,176 +0,0 @@
#! /usr/bin/env bash
### BEGIN INIT INFO
# Provides: influxdb
# Required-Start: $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start influxdb at boot time
### END INIT INFO
# this init script supports three different variations:
# 1. New lsb that define start-stop-daemon
# 2. Old lsb that don't have start-stop-daemon but define, log, pidofproc and killproc
# 3. Centos installations without lsb-core installed
#
# In the third case we have to define our own functions which are very dumb
# and expect the args to be positioned correctly.
if [ -r /lib/lsb/init-functions ]; then
source /lib/lsb/init-functions
fi
DEFAULT=/etc/default/influxdb
if [ -r $DEFAULT ]; then
source $DEFAULT
fi
if [ "x$NOFILES" == "x" ]; then
NOFILES=0
fi
if [ $NOFILES -le 0 ]; then
NOFILES=65536
fi
if [ "x$STDOUT" == "x" ]; then
STDOUT=/dev/null
fi
echo "Setting ulimit -n $NOFILES"
if ! ulimit -n $NOFILES >/dev/null 2>&1; then
echo -n "Cannot set the max number of open file descriptors"
fi
function pidofproc() {
if [ $# -ne 3 ]; then
echo "Expected three arguments, e.g. $0 -p pidfile daemon-name"
fi
pid=`pgrep -f $3`
local pidfile=`cat $2`
if [ "x$pidfile" == "x" ]; then
return 1
fi
if [ "x$pid" != "x" -a "$pidfile" == "$pid" ]; then
return 0
fi
return 1
}
function killproc() {
if [ $# -ne 3 ]; then
echo "Expected three arguments, e.g. $0 -p pidfile signal"
fi
pid=`cat $2`
kill -s $3 $pid
}
function log_failure_msg() {
echo "$@" "[ FAILED ]"
}
function log_success_msg() {
echo "$@" "[ OK ]"
}
# Process name ( For display )
name=influxdb
# Daemon name, where is the actual executable
daemon=/usr/bin/$name
if [ -z "$pidfile" ]; then
# pid file for the daemon
pidfile=/opt/$name/shared/influxdb.pid
fi
if [ -z "$config" ]; then
# Configuration file
config=/opt/$name/shared/config.toml
fi
# If the daemon is not there, then exit.
[ -x $daemon ] || exit 5
case $1 in
start)
# Checked the PID file exists and check the actual status of process
if [ -e $pidfile ]; then
pidofproc -p $pidfile $daemon > /dev/null 2>&1 && status="0" || status="$?"
# If the status is SUCCESS then don't need to start again.
if [ "x$status" = "x0" ]; then
log_failure_msg "$name process is running"
exit 1 # Exit
fi
fi
# Start the daemon.
log_success_msg "Starting the process" "$name"
# Start the daemon with the help of start-stop-daemon
# Log the message appropriately
cd /
if which start-stop-daemon > /dev/null 2>&1; then
nohup start-stop-daemon --chuid influxdb:influxdb -d / --start --quiet --oknodo --pidfile $pidfile --exec $daemon -- -pidfile $pidfile -config $config >> $STDOUT 2>&1 &
elif set | egrep '^start_daemon' > /dev/null 2>&1; then
start_daemon -u influxdb ${daemon}-daemon -pidfile $pidfile -config $config >> $STDOUT 2>&1
else
su -s /bin/sh -c "${daemon}-daemon -pidfile $pidfile -config $config >> $STDOUT 2>&1" influxdb
fi
log_success_msg "$name process was started"
;;
stop)
# Stop the daemon.
if [ -e $pidfile ]; then
pidofproc -p $pidfile $daemon > /dev/null 2>&1 && status="0" || status="$?"
if [ "$status" = 0 ]; then
if killproc -p $pidfile SIGTERM && /bin/rm -rf $pidfile; then
log_success_msg "$name process was stopped"
else
log_failure_msg "$name failed to stop service"
fi
fi
else
log_failure_msg "$name process is not running"
fi
;;
restart)
# Restart the daemon.
$0 stop && sleep 2 && $0 start
;;
status)
# Check the status of the process.
if [ -e $pidfile ]; then
if pidofproc -p $pidfile $daemon > /dev/null; then
log_success_msg "$name Process is running"
exit 0
else
log_failure_msg "$name Process is not running"
exit 1
fi
else
log_failure_msg "$name Process is not running"
exit 3
fi
;;
# reload)
# # Reload the process. Basically sending some signal to a daemon to reload its configurations.
# if [ -e $pidfile ]; then
# start-stop-daemon --stop --signal SIGHUSR2 --quiet --pidfile $pidfile --name $name
# log_success_msg "$name process reloaded successfully"
# else
# log_failure_msg "$pidfile does not exists"
# fi
# ;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
esac

View File

@ -1,34 +0,0 @@
#!/usr/bin/env bash
influx_dir=/opt/influxdb
version=REPLACE_VERSION
# create some symlinks
ln -sfn $influx_dir/versions/$version $influx_dir/current
[ -e /usr/bin/influxdb ] || ln -sfn $influx_dir/current/influxdb /usr/bin/influxdb
[ -e /usr/bin/influxdb-benchmark ] || ln -sfn $influx_dir/current/influxdb-benchmark /usr/bin/influxdb-benchmark
[ -e /usr/bin/influxdb-daemon ] || ln -sfn $influx_dir/current/scripts/influxdb-daemon.sh /usr/bin/influxdb-daemon
[ -d $influx_dir/shared ] || mkdir $influx_dir/shared
[ -e $influx_dir/shared/config.toml ] || cp $influx_dir/current/config.toml $influx_dir/shared/
[ -e $influx_dir/shared/benchmark_config.toml ] || cp $influx_dir/current/benchmark_config.toml $influx_dir/shared/
touch $influx_dir/shared/log.txt
if [ ! -L /etc/init.d/influxdb ]; then
ln -sfn $influx_dir/current/scripts/init.sh /etc/init.d/influxdb
if which update-rc.d > /dev/null 2>&1 ; then
update-rc.d -f influxdb remove
update-rc.d influxdb defaults
else
chkconfig --add influxdb
fi
fi
if ! id influxdb >/dev/null 2>&1; then
useradd --system -U -M influxdb
fi
chown -R -L influxdb:influxdb $influx_dir
chmod -R a+rX $influx_dir
# only restart if the service was already running
if /etc/init.d/influxdb status > /dev/null 2>&1; then
service influxdb restart
fi

View File

@ -1,74 +0,0 @@
#!/usr/bin/env bash
set -e
cd `dirname $0`
git checkout .
git pull --rebase
[ -f Makefile ] && make clean
git clean -dfx
./configure
modified=$(git ls-files --modified | wc -l)
if [ $modified -ne 0 ]; then
echo "Please commit or stash all your changes and try to run this command again"
exit 1
fi
git fetch --tags
if [ $# -lt 1 ]; then
current_version=`git tag | grep -v rc | sort -V | tail -n1`
current_version=${current_version#v}
version=`echo $current_version | awk 'BEGIN {FS="."}; {print $1 "." $2 "." ++$3}'`
else
version=$1
fi
echo -n "Release version $version ? [Y/n] "
read response
response=`echo $response | tr 'A-Z' 'a-z'`
if [ "x$response" == "xn" ]; then
echo "Aborting"
exit 1
fi
echo "Releasing version $version"
if ! which aws > /dev/null 2>&1; then
echo "Please install awscli see https://github.com/aws/aws-cli for more details"
exit 1
fi
make clean
make package version=$version
make binary_package distro_packages version=$version arch=386
# make arch=arm CROSS_COMPILE=arm-unknown-linux-gnueabi package version=$version PATH=$PATH:$HOME/x-tools/arm-unknown-linux-gnueabi/bin
# rpm convention is not to have dashes in the package, or at least
# that's what fpm is claiming
rpm_version=${version/-/_}
for filepath in `ls packages/*.{tar.gz,deb,rpm}`; do
[ -e "$filepath" ] || continue
echo "Uploading $filepath to S3"
filename=`basename $filepath`
latest_filename=`echo ${filename} | sed "s/${rpm_version}/latest/g" | sed "s/${version}/latest/g"`
bucket=influxdb
AWS_CONFIG_FILE=~/aws.conf aws s3 cp $filepath s3://influxdb/$filename --acl public-read --region us-east-1
AWS_CONFIG_FILE=~/aws.conf aws s3 cp $filepath s3://get.influxdb.org/$filename --acl public-read --region us-east-1
case "$version" in
*rc*) continue;; # don't do upload the latest file
*)
AWS_CONFIG_FILE=~/aws.conf aws s3 cp $filepath s3://influxdb/${latest_filename} --acl public-read --region us-east-1
AWS_CONFIG_FILE=~/aws.conf aws s3 cp $filepath s3://get.influxdb.org/${latest_filename} --acl public-read --region us-east-1
;;
esac
done
branch=`git rev-parse --abbrev-ref HEAD`
git tag v$version
git push origin --tags