packages: lsyncd/lsyncd.init (NEW), lsyncd/lsyncd.logrotate (NEW), lsyncd/l...

blues blues at pld-linux.org
Mon Nov 23 15:24:00 CET 2009


Author: blues                        Date: Mon Nov 23 14:23:59 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- initial

---- Files affected:
packages/lsyncd:
   lsyncd.init (NONE -> 1.1)  (NEW), lsyncd.logrotate (NONE -> 1.1)  (NEW), lsyncd.spec (NONE -> 1.1)  (NEW), lsyncd.sysconfig (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/lsyncd/lsyncd.init
diff -u /dev/null packages/lsyncd/lsyncd.init:1.1
--- /dev/null	Mon Nov 23 15:24:00 2009
+++ packages/lsyncd/lsyncd.init	Mon Nov 23 15:23:53 2009
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# lsyncd	This shell script takes care of starting and stopping lsyncd
+#
+# chkconfig:	345 90 25
+# description:	lsync daemon
+# processname:	lsync
+#
+# pidfile:	/var/run/lsyncd.pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down lsyncd
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+# Get service configuration
+[ -f /etc/sysconfig/lsyncd ] && . /etc/sysconfig/lsyncd
+
+start() {
+	# Start daemons.
+	if [ ! -f /var/lock/subsys/lsyncd ]; then
+		msg_starting lsyncd
+		daemon /usr/bin/lsyncd --dparam=pidfile=/var/run/lsyncd.pid ${LSYNCD_OPTIONS}
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/lsyncd
+	else
+		msg_already_running lsyncd
+	fi
+}
+
+stop() {
+	# Stop daemons.
+	if [ -f /var/lock/subsys/lsyncd ]; then
+		msg_stopping lsyncd
+		killproc lsyncd
+		rm -f /var/lock/subsys/lsyncd >/dev/null 2>&1
+	else
+		msg_not_running lsyncd
+	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/lsyncd ]; then
+		stop
+		start
+	else
+		msg_not_running lsyncd
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status lsyncd
+	exit $?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL

================================================================
Index: packages/lsyncd/lsyncd.logrotate
diff -u /dev/null packages/lsyncd/lsyncd.logrotate:1.1
--- /dev/null	Mon Nov 23 15:24:00 2009
+++ packages/lsyncd/lsyncd.logrotate	Mon Nov 23 15:23:53 2009
@@ -0,0 +1,3 @@
+/var/log/lsyncd {
+	create 640 root logs
+}

================================================================
Index: packages/lsyncd/lsyncd.spec
diff -u /dev/null packages/lsyncd/lsyncd.spec:1.1
--- /dev/null	Mon Nov 23 15:24:00 2009
+++ packages/lsyncd/lsyncd.spec	Mon Nov 23 15:23:53 2009
@@ -0,0 +1,81 @@
+# $Revision$, $Date$
+Summary:	Live Syncing (Mirror) Daemon
+Name:		lsyncd
+Version:	1.26
+Release:	0.1
+License:	GPL v2+
+Group:		Networking/Utilities
+Source0:	http://lsyncd.googlecode.com/files/%{name}-%{version}.tar.gz
+# Source0-md5:	ff06aed03a012c84c0526a4f892900fe
+Source1:	%{name}.init
+Source2:	%{name}.sysconfig
+Source3:	%{name}.logrotate
+URL:		http://code.google.com/p/lsyncd/
+Requires:	rsync
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Lsyncd uses rsync to synchronize local directories with a remote machine
+running rsyncd. Lsyncd watches multiple directories trees through inotify.
+The first step after adding the watches is to rsync all directories with the
+remote host, and then sync single file by collecting the inotify events. So
+lsyncd is a light-weight live mirror solution that should be easy to install
+and use while blending well with your system.
+
+%prep
+%setup -q
+
+%build
+%configure
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sysconfdir},/etc/{rc.d/init.d,logrotate.d,sysconfig},/var/log}
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+:> $RPM_BUILD_ROOT/var/log/%{name}
+
+install lsyncd.conf.xml $RPM_BUILD_ROOT%{_sysconfdir}
+
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+install %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+#%env_update
+/sbin/chkconfig --add lsyncd
+%service lsyncd restart "lsync server"
+
+%preun
+#%env_update
+if [ "$1" = "0" ]; then
+	%service lsyncd stop
+	/sbin/chkconfig --del lsyncd
+fi
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS ChangeLog NEWS README TODO
+%attr(640,root,root) %config(noreplace) %{_sysconfdir}/lsyncd.conf.xml
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(755,root,root) %{_bindir}/%{name}
+%attr(640,root,root) %ghost /var/log/%{name}
+%attr(754,root,root) /etc/rc.d/init.d/lsyncd
+%{_mandir}/man1/*.1*
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2009/11/23 14:23:53  blues
+- initial
+

================================================================
Index: packages/lsyncd/lsyncd.sysconfig
diff -u /dev/null packages/lsyncd/lsyncd.sysconfig:1.1
--- /dev/null	Mon Nov 23 15:24:00 2009
+++ packages/lsyncd/lsyncd.sysconfig	Mon Nov 23 15:23:53 2009
@@ -0,0 +1,7 @@
+# lsyncd startup configuration file
+
+# Try to define nice-level for running lsyncd
+SERVICE_RUN_NICE_LEVEL="+5"
+
+# Additional options to lsyncd: 
+#LSYNCD_OPTIONS=""
================================================================


More information about the pld-cvs-commit mailing list