#!/bin/bash
#
# chkconfig: 345 83 17
### BEGIN INIT INFO
# Provides:          sync-engine
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: sync-engine Daemon
# Description:       Start the sync-engine service
### END INIT INFO

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

SYSCONF_FILE=/var/lock/subsys/sync-engine

# See how we were called.
case "$1" in
  start)
	gprintf "Starting sync-engine: "
	echo_success
	echo
	touch $SYSCONF_FILE
	daemon dbus-launch sync-engine --detached

	;;
  stop)
	gprintf "Stopping sync-engine: "
 	killproc sync-engine
	echo_success
	echo
	rm -f $SYSCONF_FILE
	;;
  status)
	if [ -f $SYSCONF_FILE ]
	then
		gprintf "sync-engine is running\n"
	else
		gprintf "synce-engine is not running\n"
	fi
	;;
  restart)
	$0 stop
	$0 start
	;;
  *)
	gprintf "Usage: %s {start|stop|restart|status}\n" "$0"
	exit 1
esac

exit 0
