Skip to topic | Skip to bottom
Home
Sysadmin
Sysadmin.AptLogr1.2 - 13 Feb 2007 - 01:53 - AlsteRtopic end
You are here: Sysadmin > AptLog

Start of topic | Skip to actions

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
You are here: Sysadmin > AptLog

to top

Copyright © 1999-2008 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding this tool? Send feedback (in English, Francais, Deutsch or Dutch).