I need to have list of all commands with time when command executed that linux user has fired during whole day, every day.
For that i created a shell script in which i used history command and scheduled in crontab. But its not giving any output.
Can any one please help me on this ? Also suggest if any other better way to do it with code.
Gracias de antemano.
#!/bin/bash dt1=$(TZ=GMT+18:30: date +%d/%m/%y) dt=$(TZ=GMT+18:30: date +%d-%m-%y) mkdir /tmp/comm_hist/$dt chmod 777 /tmp/comm_hist/$dt for user in `cat /etc/passwd | grep "bash" | cut -d":" -f1` do su - $user <<EOF HISTFILE=~/.bash_history set -o history #history | grep "$dt1" > /tmp/comm_hist/$dt/$user.txt history > /tmp/comm_hist/$dt/$user.txt EOF done
preguntado el 28 de mayo de 14 a las 14:05