Skip to content

Instantly share code, notes, and snippets.

@jaderobbins
Created June 15, 2010 17:03
Show Gist options
  • Save jaderobbins/439381 to your computer and use it in GitHub Desktop.
Save jaderobbins/439381 to your computer and use it in GitHub Desktop.
#!/bin/bash
##
# chkconfig: 2345 75 25
# description: havege entropy daemon
#
# source function library
#. /etc/rc.d/init.d/functions
. /lib/lsb/init-functions
RETVAL=0
prog="haveged"
success=0
failure=1
case "$1" in
start)
echo -n $"Starting $prog: "
/usr/local/sbin/$prog -w 1024 -v 1 && log_success_msg || failure
RETVAL=$?
[ "$RETVAL" = 0 ] && touch /var/lock/subsys/$prog
echo
;;
stop)
echo -n $"Stopping $prog: "
if [ -e /var/run/$prog.pid ]; then
kill `cat /var/run/$prog.pid` && log_success_msg || failure
else
failure
fi
RETVAL=$?
[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/$prog
echo
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $prog [start|stop|restart]"
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment