You are here: Sysadmin > AptLog
APT-LOG
Table of content :
O que é ?
apt-log é um Shell Script criado especialmente para o Indydevel. Seu objetivo é criar um log das ações que os usuários fazem com o programa apt-get.
Usando
depois do download, torne o script executável (chmod +x apt-log.sh), execute-o com ./apt-log.sh
você pode ler o log em /tmp/apt.log
Código
#!/bin/bash
# apt-log
#
# Author: Joao Paulo Vanzuita <joaopaulo@riseup.net>
#
# TODO: - use "user list" in memory
# - use APTLOG variable instead > /tmp/apt.log
# temporary file
USERLIST='/tmp/users'
APTLOG='/tmp/apt.log'
# this get all users system and put in users file
#
cut -d":" -f1 /etc/passwd > $USERLIST
while [ $USERLIST != "" ]
do
# first name of the list in $UHOME
GETLINE="sed -n 1p $USERLIST"
$GETLINE
UHOME=$($GETLINE)
# if there isnt more names in $UHMOE, exit
if [ -z $UHOME ]
then
exit 0
fi
# check if it's a direcotry
if [ -d /home/$UHOME ]
then
echo "here will join user directory and gets .bash_history"
sed p /home/$UHOME/.bash_history | grep apt-get > /tmp/apt.log
else
# i will delete this else
echo "isnt a directory"
fi
# delete the first name of the list
DELU="sed -i "1d" $USERLIST"
$DELU
done
# cleaning the house
rm $USERLIST
to top
Sysadmin.AptLog moved from Sysadmin.apt-log on 13 Feb 2007 - 01:53 by AlsteR -
put it back