About

Resillo Sync is the successor to btsync.

The following script is an init script that can be placed at /etc/init.d/rslsync, made executable with chmod +x /etc/init.d/rslsync and then by issuing service start rslsync will start the rslsync daemon.

The script starts the rslsync daemon under the user www-data configurable by changing the DAEMON_USER variable at the top of the script.

Additionally, the script assumes that the configuration file is placed at /etc/rslsync.conf (also configurable by changing the DAEMON_CONFIG variable at the top of the script).

Code

rslsync
#! /bin/sh
### BEGIN INIT INFO
# Provides:          rslsync
# Required-Start:    $local_fs $remote_fs $network $syslog $named $openvpn
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:	     0 1 6
# Short-Description: Start rslsync.
# Description:       Starts the rslsync daemon.
### END INIT INFO
 
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      ##
##  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  ##
##  rights of fair usage, the disclaimer and warranty conditions.        ##
###########################################################################
 
PATH=/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/local/bin/rslsync
DAEMON_USER=www-data
DAEMON_CONFIG=/etc/rslsync.conf
 
# Get lsb functions
. /lib/lsb/init-functions
 
do_start () {
	log_begin_msg "Starting rslsync daemon..."
	HOMEDIR=`getent passwd $DAEMON_USER | cut -d: -f6`
	if [ -x $DAEMON ]; then
		HOME="$HOMEDIR" start-stop-daemon --start -c $DAEMON_USER -u $DAEMON_USER --background --exec $DAEMON -- --config $DAEMON_CONFIG
	fi
	log_end_msg $?
}
do_stop () {
	log_begin_msg "Stopping rslsync daemon..."
	HOMEDIR=`getent passwd $DAEMON_USER | cut -d: -f6`
	if [ -x $DAEMON ]; then
		start-stop-daemon -o -c $DAEMON_USER -K -u $DAEMON_USER -x $DAEMON
	fi
	log_end_msg $?
}
 
status () {
	status_of_proc "$DAEMON" rslsync
}
 
case "$1" in
  start)
	do_start
	;;
  restart)
  	do_stop
  	/bin/sleep 1
  	do_start
  	;;
  status)
  	status
  	;;
  stop)
	do_stop
	;;
  *)
	echo "Usage: rslsync [start|stop|restart|status]" >&2
	exit 3
	;;
esac
 
exit 0