#!/bin/sh
#
# sfssd		SFS server daemon	
#
# chkconfig: 345 82 78
# description:  The Self-Certifying File System (SFS) is a secure, 
#   global file system with completely decentralized control. SFS lets 
#   you access your files from anywhere and share them with anyone,
#   anywhere. Anyone can set up an SFS server, and any user can access 
#   any server from any client. SFS lets you share files across 
#   administrative realms without involving administrators or 
#   certification authorities.
# processname: sfssd 

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/sfssd -a -f /etc/sfs/sfs_host_key ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting sfssd: "
        daemon sfssd 
	RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sfssd
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down sfssd: "
	killproc sfssd 
	RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sfssd
        ;;
  status)
	status sfssd 
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
        echo "Usage: sfssd {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL
