Browse Source

%status and pidfile handling

master
Michael van Elst 23 years ago committed by Ralf S. Engelschall
parent
commit
3d7934fce0
  1. 6
      openssh/openssh.spec
  2. 16
      openssh/rc.openssh
  3. 24
      rsync/rc.rsync
  4. 6
      rsync/rsync.spec

6
openssh/openssh.spec

@ -38,7 +38,7 @@ Distribution: OpenPKG [CORE]
Group: Security
License: BSD
Version: %{V_base}%{V_portable}
Release: 20030715
Release: 20030717
# package options
%option with_fsl yes
@ -63,8 +63,8 @@ Source9: http://chrootssh.sourceforge.net/download/osshChroot-%{V_chroot}.d
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20030710, perl
PreReq: OpenPKG, openpkg >= 20030710
BuildPreReq: OpenPKG, openpkg >= 20030716, perl
PreReq: OpenPKG, openpkg >= 20030716
BuildPreReq: openssl, zlib
PreReq: openssl, zlib
%if "%{with_pam}" == "yes"

16
openssh/rc.openssh

@ -13,11 +13,19 @@
%common
openssh_signal () {
if [ -f "@l_prefix@/var/openssh/sshd.pid" ]; then
kill -$1 `cat @l_prefix@/var/openssh/sshd.pid`
fi
openssh_pidfile="@l_prefix@/var/openssh/sshd.pid"
[ -f $openssh_pidfile ] && kill -$1 `cat $openssh_pidfile`
}
%status -p 200 -u @l_susr@ -o
openssh_usable="unknown"
openssh_active="no"
opServiceEnabled openssh && \
openssh_signal 0 && openssh_active="yes"
echo "openssh_enable=\"$openssh_enable\""
echo "openssh_usable=\"$openssh_usable\""
echo "openssh_active=\"$openssh_active\""
%start -p 200 -u @l_susr@
opServiceEnabled openssh || exit 0
@l_prefix@/bin/sshd
@ -25,6 +33,8 @@
%stop -p 200 -u @l_susr@
opServiceEnabled openssh || exit 0
openssh_signal TERM
# sshd removes the pidfile itself
# rm -f $openssh_pidfile 2>/dev/null || true
%restart -u @l_susr@
opServiceEnabled openssh || exit 0

24
rsync/rc.rsync

@ -15,6 +15,18 @@
rsync_cfgfile="@l_prefix@/etc/rsync/rsync.conf"
rsync_logfile="@l_prefix@/var/rsync/rsync.log"
rsync_pidfile="@l_prefix@/var/rsync/rsync.pid"
rsync_signal () {
[ -f $rsync_pidfile ] && kill -$1 `cat $rsync_pidfile`
}
%status -p 200 -u @l_susr@ -o
rsync_usable="unknown"
rsync_active="no"
opServiceEnabled rsync && \
rsync_signal 0 && rsync_active="yes"
echo "rsync_enable=\"$rsync_enable\""
echo "rsync_usable=\"$rsync_usable\""
echo "rsync_active=\"$rsync_active\""
%start -p 200 -u @l_susr@
opServiceEnabled rsync || exit 0
@ -23,16 +35,14 @@
%stop -p 200 -u @l_susr@
opServiceEnabled rsync || exit 0
if [ -f $rsync_pidfile ]; then
kill -TERM `cat $rsync_pidfile`
fi
rsync_signal TERM
# rsync removes the pidfile itself
# rm -f $rsync_pidfile 2>/dev/null || true
%restart -u @l_susr@
opServiceEnabled rsync || exit 0
if [ -f $rsync_pidfile ]; then
kill -TERM `cat $rsync_pidfile`
sleep 2
fi
rsync_signal TERM
sleep 2
nice -n $rsync_nicelevel @l_prefix@/bin/rsync $rsync_flags \
--daemon --config=$rsync_cfgfile

6
rsync/rsync.spec

@ -33,7 +33,7 @@ Distribution: OpenPKG [CORE]
Group: Filesystem
License: GPL
Version: 2.5.6
Release: 20030710
Release: 20030717
# list of sources
Source0: http://rsync.samba.org/ftp/rsync/rsync-%{version}.tar.gz
@ -44,8 +44,8 @@ Patch0: rsync.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20030710
PreReq: OpenPKG, openpkg >= 20030710
BuildPreReq: OpenPKG, openpkg >= 20030716
PreReq: OpenPKG, openpkg >= 20030716
AutoReq: no
AutoReqProv: no

Loading…
Cancel
Save