Hot answers tagged

2

rotate 0 from the man page rotate count Log files are rotated count times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather than rotated. You probably want rotate 9 As to why you are seeing all the other files, my guess is that they are old (check the date/time) and ...


1

Slight change of adams solution which doesn't break if root is logged into more than one terminals: login_info="$(who | head -n1 | cut -d'(' -f2 | cut -d')' -f1)" message="$( printf "ALERT - Root Shell Access (%s) on:\n" "$(hostname)" date echo who )" mail -s "Alert: Root Access from ${login_info}" admin <<< "${message}"



Only top voted, non community-wiki answers of a minimum length are eligible