Listing 2 OpenPKG packaging for rsync (rc.rsync: run-commands)
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
%config
rsync_enable="yes"
rsync_flags=""
rsync_log_numfiles="5"
rsync_log_minsize="512K"
rsync_log_complevel="9"
%common
rsync_cfgfile="@l_prefix@/etc/rsync/rsync.conf"
rsync_logfile="@l_prefix@/var/rsync/rsync.log"
rsync_pidfile="@l_prefix@/var/rsync/rsync.pid"
%start -p 200 -u root
if opServiceEnabled rsync; then
@l_prefix@/bin/rsync $rsync_flags \
--daemon --config=$rsync_cfgfile
fi
%stop -p 200 -u root
if opServiceEnabled rsync; then
if [ -f $rsync_pidfile ]; then
kill -TERM `cat $rsync_pidfile`
fi
fi
%restart -u root
if opServiceEnabled rsync; then
if [ -f $rsync_pidfile ]; then
kill -TERM `cat $rsync_pidfile`
sleep 2
fi
@l_prefix@/bin/rsync $rsync_flags \
--daemon --config=$rsync_cfgfile
fi
%reload -u root
if opServiceEnabled rsync; then
if [ -f $rsync_pidfile ]; then
kill -HUP `cat $rsync_pidfile`
fi
fi
%daily -u root
if opServiceEnabled rsync; then
shtool rotate -f \
-n ${rsync_log_numfiles} \
-s ${rsync_log_minsize} \
-d -z ${rsync_log_complevel} \
-o @l_musr@ -g @l_mgrp@ -m 644 \
-E "kill -HUP `cat $rsync_pidfile`" \
$rsync_logfile
fi
%env
if opServiceEnabled rsync; then
if [ -f "@l_prefix@/bin/ssh" ]; then
RSYNC_RSH="@l_prefix@/bin/ssh"
export RSYNC_RSH
fi
fi
|