-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here are my attachments :-/ oO(too much coffee)

- - Markus Nass

- --
Key fingerprint = DC3C 257C 2B71 8FA4 F609  F7F7 7C14 F806 5665 77FD

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Was nicht fliegen kann, kann auch nicht abstürzen.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFENVNAfBT4BlZld/0RAjFmAKCygqzhw7NDeDFrLdlBtoQTgiUo9wCgpkPK
sKBs6bgQx2yC8cEg9Yba2qA=
=qHAj
-----END PGP SIGNATURE-----
--- /etc/cron.daily/acct.old    2006-03-23 23:41:51.000000000 +0100
+++ /etc/cron.daily/acct        2006-04-06 18:09:18.000000000 +0200
@@ -4,11 +4,21 @@
 #
 # Written by Ian A. Murdock <[EMAIL PROTECTED]>
 # Modified by Dirk Eddelbuettel <[EMAIL PROTECTED]>   
+# Modified by Markus Nass <[EMAIL PROTECTED]>
 
 if [ -x /usr/sbin/accton ]
 then
-    cd /var/account
-    savelog -g adm -m 0640 -u root -c 7 /var/account/pacct >/dev/null
+    test -f /etc/default/acct && . /etc/default/acct
+
+    if [ -z "$FILE" ]
+    then
+       cd /var/account
+       savelog -g adm -m 0640 -u root -c 7 /var/account/pacct >/dev/null
+    else
+       cd "$(echo "$FILE" | grep -o "\/.*\/")"
+       savelog -g adm -m 0640 -u root -c 7 $FILE >/dev/null
+    fi
+    
     /etc/init.d/acct stop >/dev/null
     /etc/init.d/acct start >/dev/null
 fi
--- /etc/init.d/acct.old        2006-03-23 23:41:40.000000000 +0100
+++ /etc/init.d/acct    2006-04-06 18:17:06.000000000 +0200
@@ -4,11 +4,16 @@
 #
 # Initial version written by Ian Murdock <[EMAIL PROTECTED]>
 # This version written by Dirk Eddelbuettel <[EMAIL PROTECTED]>   
+# Modified by Markus Nass <[EMAIL PROTECTED]>
 
 set -e 
 
-compare_kernel_version_and_exit_if_needed() {
+START_ACCT=1
+
+test -x /usr/sbin/accton || exit 0
+test -f /etc/default/acct && . /etc/default/acct 
 
+compare_kernel_version_and_exit_if_needed() {
     # thanks to Joey Hess for this shell script snippet 
     # -- easier than my previous perl code
     cmp_major=2
@@ -36,51 +41,45 @@
     fi
 }
 
-test -x /usr/sbin/accton || exit 0
-
-# If you want to keep acct installed, but not started automatically, set this
-# variable to 0. Because /etc/cron.daily/acct calls this file daily, it is
-# not sufficient to stop acct once after booting if your machine remains up.
-START_ACCT=1
-
-if [ $START_ACCT -eq 1 ] 
-then
-    compare_kernel_version_and_exit_if_needed
-fi
+start() {
+    # Have to turn this on to be able to test the return code
+    set +e
+    echo -n "Starting process accounting: "
+    
+    if [ -n "$FILE" ]
+    then
+       /usr/sbin/accton $FILE >/dev/null 2>&1
+    else
+       /usr/sbin/accton on >/dev/null 2>&1
+    fi
+    
+    rv=$?
 
-case "$1" in
-  start)
-    # We start acct only if the switch variable tells us to
-    if [ $START_ACCT -eq 1 ] 
+    if [ $rv -eq 0 ]
+    then
+       echo "done."
+    elif [ $rv -eq 38 ]
     then
-       # Have to turn this on to be able to test the return code
-       set +e
-       echo -n "Starting process accounting: "
-       /usr/sbin/accton /var/account/pacct 2>/dev/null
-       rv=$?
-       if [ $rv -eq 0 ]
-       then
-           echo "done."
-       elif [ $rv -eq 38 ]
-       then
-           echo "failed"
-           echo "Process accounting not available on this system."
-       elif [ $rv -eq 16 ]
-       then
-           echo "failed"
-           echo "Process accounting already running on this system."
-       else
-           logger -f /var/log/daemon.log \
-                   "Unexpected error code $rv received in /etc/init.d/acct"
-       fi
-       set -e 
+       echo "failed"
+       echo "Process accounting not available on this system."
+    elif [ $rv -eq 16 ]
+    then
+       echo "failed"
+       echo "Process accounting already running on this system."
+    else
+       logger -f /var/log/daemon.log \
+       "Unexpected error code $rv received in /etc/init.d/acct"
     fi
-    ;;
-  stop)
-    echo -n "Stopping process accounting: "
+
+    set -e
+}
+
+stop() {
     # Have to turn this on to be able to test the return code
     set +e
-    /usr/sbin/accton 2>/dev/null
+    echo -n "Stopping process accounting: "
+    /usr/sbin/accton off >/dev/null 2>&1
+    
     if [ $? -eq 0 ]
     then
        echo "done."
@@ -88,45 +87,33 @@
       echo "failed."
       echo "Process accounting not available on this system."
     fi
+
     set -e
+}
+
+case "$1" in
+  start)
+    # We start acct only if the switch variable tells us to
+    if [ $START_ACCT -eq 1 ] 
+    then
+       compare_kernel_version_and_exit_if_needed
+       start
+    fi
     ;;
-  restart|force-reload) 
-    echo -n "Restaring process accounting: "
-    # Have to turn this on to be able to test the return code
-    set +e
-    /usr/sbin/accton 2>/dev/null
-    if [ $? -eq 0 ]
+  stop)
+    if [ $START_ACCT -eq 1 ] 
     then
-       echo "done."
-    else
-       echo "failed."
-       echo "Process accounting not available on this system."
+       compare_kernel_version_and_exit_if_needed
+       stop
     fi
-    set -e
+    ;;
+  restart|force-reload) 
     # We start acct only if the switch variable tells us to
     if [ $START_ACCT -eq 1 ] 
     then
-       # Have to turn this on to be able to test the return code
-       set +e
-       echo -n "Starting process accounting: "
-       /usr/sbin/accton /var/account/pacct 2>/dev/null
-       rv=$?
-       if [ $rv -eq 0 ]
-       then
-           echo "done."
-       elif [ $rv -eq 38 ]
-       then
-           echo "failed"
-           echo "Process accounting not available on this system."
-       elif [ $rv -eq 16 ]
-       then
-           echo "failed"
-           echo "Process accounting already running on this system."
-       else
-           logger -f /var/log/daemon.log \
-                   "Unexpected error code $rv received in /etc/init.d/acct"
-       fi
-       set -e 
+       compare_kernel_version_and_exit_if_needed
+       stop
+       start
     fi
     ;;
   *)
# If you want to keep acct installed, but not started automatically, set this
# variable to 0. Because /etc/cron.daily/acct calls this file daily, it is
# not sufficient to stop acct once after booting if your machine remains up.
START_ACCT=1

# If you want to keep accounting information somewhere as in /var/account/pacct
# set this variable to an existing location.
#FILE="/var/log/account/pacct"

Reply via email to