#!/bin/bash if [[ "$1" = "-h" || "$1" = "--help" ]] then echo "Usage: $(basename $0) [user]" echo "" echo " -h [--help] - shows this help" exit 0 fi if [[ -z $1 ]] then for i in `ps -e -o user --no-header | sort | uniq`; do echo "$i: $(ps -u $i -o rss --no-header | paste -sd+ -| bc)KB" done; else echo "$1: $(ps -u $1 -o rss --no-header | paste -sd+ -| bc) KB" fi
rsyslog – redirect program logs to separate file
There is nothing complicated – just create new configuration file and restart service:
echo "if $programname == 'program_name' then /var/log/*rogram_name.log
& ~" > /etc/rsyslog.d/program_name.conf
service rsyslog restart
“& ~” – means, do not duplicate infomation in general syslog file