Hello :) I recently had to deal with acct, and its configuration. In order to meet my needs, I made a few modifications to its init scripts and environment, and added some configuration items to it. I'd like to share these with the community, if you find them useable ? First, I've added a configuration file to the package : /etc/conf.d/acct. # ACCT_LOG specifies the accounting logging file. # Remember to create it manually if it doesn't yet exist. # Default : ACCT_LOG="/var/account/pacct" ACCT_LOG="/var/account/pacct" # REPORT_OPTS contains arguments for the "sa" command, used for console-reporting. # Please run "sa --help" or "man sa" to get a description of available options. REPORT_OPTS="--sort-real-time --list-all-names --percentage" Then, I had to modify the /etc/init.d/acct script to deal with these new configuration items : #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 opts="${opts} report" depend() { need localmount } start() { if [ -z ${ACCT_LOG} ] ; then ewarn "Unable to load configuration. Please check /etc/conf.d/acct." return 1 fi if ! [ -f ${ACCT_LOG} ] ; then ewarn "${ACCT_LOG} does not exists. Trying to create it automatically..." touch ${ACCT_LOG} chmod 600 ${ACCT_LOG} fi ebegin "Starting accounting" /usr/sbin/accton ${ACCT_LOG} eend ${ret} } stop() { ebegin "Stopping accton" /usr/sbin/accton eend $? } report() { if ! service_started "${myservice}" ; then ewarn "" ewarn "Service is not started. Statistics may be obsolete !" ewarn "If you really wish to get this information, please run :" ewarn "" ewarn " sa ${REPORT_OPTS} ${ACCT_LOG}" ewarn "" else sa ${REPORT_OPTS} ${ACCT_LOG} fi return $? } restart() { svc_stop svc_start } And that's all. Just a little enhancement, as you see ;-). But it allows to successfully run this tool without any further configuration, which may gain time to other users ?
Created attachment 76613 [details] acct config defaults (/etc/conf.d/acct)
Created attachment 76614 [details] /etc/init.d/acct
cleaned up and added to cvs, thanks