diff --git a/psacct.init b/psacct.init index e1140d0..90194aa 100755 --- a/psacct.init +++ b/psacct.init @@ -6,23 +6,43 @@ # # chkconfig: - 90 10 # description: Starts and stops process accounting +# short-description: Starts and stops process accounting + # Source function library. . /etc/init.d/functions # The location of the accounting file ACCTFILE=/var/account/pacct +LOCKFILE=/var/lock/subsys/psacct start() { [ ! -r $ACCTFILE ] && touch $ACCTFILE && chmod 600 $ACCTFILE - action $"Starting process accounting: " /sbin/accton $ACCTFILE - touch /var/lock/subsys/psacct + if [ -r $ACCTFILE ]; then + action $"Starting process accounting: " /sbin/accton $ACCTFILE + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + touch $LOCKFILE + else + exit 3 + fi + else + exit 1 + fi } stop() { + action $"Shutting down process accounting: " /sbin/accton - rm -f /var/lock/subsys/psacct + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + rm -f $LOCKFILE + exit 3 + else + exit 0 + fi } + # See how we were called. case "$1" in start) @@ -32,11 +52,10 @@ case "$1" in stop ;; status) - if [ -e /var/lock/subsys/psacct ]; then + if [ -e $LOCKFILE ]; then echo $"Process accounting is enabled." else echo $"Process accounting is disabled." - exit 3 fi ;; restart|reload) diff --git a/psacct.spec b/psacct.spec index cd6394b..4ba461b 100644 --- a/psacct.spec +++ b/psacct.spec @@ -12,7 +12,7 @@ Summary: Utilities for monitoring process activities Name: psacct Version: 6.3.2 -Release: 45%{?dist} +Release: 46%{?dist} License: GPL Group: Applications/System Source: ftp://ftp.gnu.org/pub/gnu/acct-6.3.2.tar.gz @@ -78,8 +78,8 @@ make [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT{/sbin,%{_bindir},%{_mandir},%{_sbindir}} make install prefix=$RPM_BUILD_ROOT%{_prefix} \ - bindir=$RPM_BUILD_ROOT%{_bindir} sbindir=$RPM_BUILD_ROOT%{_sbindir} \ - infodir=$RPM_BUILD_ROOT%{_datadir}/info mandir=$RPM_BUILD_ROOT%{_mandir} + bindir=$RPM_BUILD_ROOT%{_bindir} sbindir=$RPM_BUILD_ROOT%{_sbindir} \ + infodir=$RPM_BUILD_ROOT%{_datadir}/info mandir=$RPM_BUILD_ROOT%{_mandir} # move accton to /sbin -- leave historical symlink mv $RPM_BUILD_ROOT%{_sbindir}/accton $RPM_BUILD_ROOT/sbin/accton @@ -169,6 +169,10 @@ fi %{_infodir}/accounting.info.gz %changelog +* Wed Jul 25 2007 Ivana Varekova - 6.3.2-46 +- Resolves: #247034 + fix init script + * Mon May 28 2007 Ivana Varekova - 6.3.2-45 - fix the return value of "service psacct status" command