Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer #119

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions server/init-script/convergence.rhel6
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/sh
#
# crond Start/Stop the convergence notary
#
# chkconfig: 345 95 10
# description: convergence notaries provide an alternative to SSL trust chains

### BEGIN INIT INFO
# Provides: convergence
# Required-Start: $local_fs $network $named $time
# Required-Stop: $local_fs $network $named $time
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts The convergence daemon processes
# Description: Start convergence notary.
### END INIT INFO

RETVAL=0
prog="convergence"
exec=/usr/bin/convergence-notary
lockfile=/var/lock/subsys/convergence
config=/etc/sysconfig/convergence
pidfile=/var/run/convergence.pid

# Source function library.
. /etc/rc.d/init.d/functions

[ -e ${config} ] && . ${config}

start() {
if [ $UID -ne 0 ] ; then
echo "User has insufficient privilege."
exit 4
fi
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
$exec -p $PORT -s $SSL -c $CERT -k $KEY -i "$INTERFACE" -u "$USER" -g "$GROUP" && \
success || failure
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
if [ $UID -ne 0 ] ; then
echo "User has insufficient privilege."
exit 4
fi
echo -n $"Stopping $prog: "
if [ -n "`pidfileofproc $prog`" ]; then
killproc $exec
RETVAL=0
else
failure $"Stopping $prog"
fi
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
stop
start
}

rh_status() {
status -p $pidfile $prog
}


case "$1" in
start)
$1
;;
stop)
$1
;;
restart)
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit $?

132 changes: 132 additions & 0 deletions server/init-script/convergence.ubu11
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#! /bin/bash

### BEGIN INIT INFO
# Provides: convergence
# Required-Start: $local_fs $remote_fs $network $named $time
# Required-Stop: $local_fs $remote_fs $network $named $time
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts The convergence daemon processes
# Description: Start convergence notary.
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/convergence-notary
NAME=convergence
DESC="convergence notary"
CONVERGENCEPID=/var/run/convergence.pid
WAITFORDAEMON=30
ARGS=""
# Let's try to figure our some sane defaults:
if [ -r /proc/sys/fs/file-max ]; then
system_max=`cat /proc/sys/fs/file-max`
if [ "$system_max" -gt "80000" ] ; then
MAX_FILEDESCRIPTORS=32768
elif [ "$system_max" -gt "40000" ] ; then
MAX_FILEDESCRIPTORS=16384
elif [ "$system_max" -gt "10000" ] ; then
MAX_FILEDESCRIPTORS=8192
else
MAX_FILEDESCRIPTORS=1024
cat << EOF

Warning: Your system has very few filedescriptors available in total.

Maybe you should try raising that by adding 'fs.file-max=100000' to your
/etc/sysctl.conf file. Feel free to pick any number that you deem appropriate.
Then run 'sysctl -p'. See /proc/sys/fs/file-max for the current value, and
file-nr in the same directory for how many of those are used at the moment.

EOF
fi
else
MAX_FILEDESCRIPTORS=8192
fi

NICE=""

test -x $DAEMON || exit 0

test -f /etc/default/$NAME && . /etc/default/$NAME

wait_for_deaddaemon () {
pid=$1
sleep 1
if test -n "$pid"
then
if kill -0 $pid 2>/dev/null
then
echo -n "."
cnt=0
while kill -0 $pid 2>/dev/null
do
cnt=`expr $cnt + 1`
if [ $cnt -gt $WAITFORDAEMON ]
then
echo " FAILED."
return 1
fi
sleep 1
echo -n "."
done
fi
fi
return 0
}


case "$1" in
start)

if [ -n "$MAX_FILEDESCRIPTORS" ]; then
echo -n "Raising maximum number of filedescriptors (ulimit -n) to $MAX_FILEDESCRIPTORS"
if ulimit -n "$MAX_FILEDESCRIPTORS" ; then
echo "."
else
echo ": FAILED."
fi
fi

echo "Starting $DESC: $NAME..."

start-stop-daemon --start --quiet --oknodo \
--pidfile $CONVERGENCEPID \
$NICE \
--exec $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "Stopping $DESC: "
pid=`cat $CONVERGENCEPID 2>/dev/null` || true

if test ! -f $CONVERGENCEPID -o -z "$pid"; then
echo "not running (there is no $CONVERGENCEPID)."
exit 0
fi

if start-stop-daemon --stop --signal INT --quiet --pidfile $CONVERGENCEPID; then
wait_for_deaddaemon $pid
echo "$NAME."
elif kill -0 $pid 2>/dev/null
then
echo "FAILED (Is $pid not $NAME? Is $DAEMON a different binary now?)."
else
echo "FAILED ($DAEMON died: process $pid not running; or permission denied)."
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac

exit 0
12 changes: 12 additions & 0 deletions server/installer/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

Convergence Installer
---------------------

See the COPYING above for license restrictions.

The convergence-installer.py does a complete install of all
convergence components.

See: convgergence-installer.py -h

for more information.
Loading