first commit

This commit is contained in:
poka 2019-12-12 20:56:02 +00:00
commit c0ffbeec86
3 changed files with 35 additions and 0 deletions

13
install_log.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
path="/usr/local/bin"
sudo cp $MY_PATH/log.sh $path/log
sudo cp $MY_PATH/seelog.sh $path/seelog
sudo chmod 755 $path/log $path/seelog
exit 0

9
log.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
[ ! -e $HOME/.log ] && mkdir $HOME/.log
echo $HOME/.log/$(date +"%d-%b-%y_%H-%M-%S")_shell.log > $HOME/.log/last.txt
script -f $HOME/.log/$(date +"%d-%b-%y_%H-%M-%S")_shell.log
exit 0

13
seelog.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
path="/var/log/users"
if [ "$1" = "root" ] || [ "$1" = "" ]; then
file=$(cat $HOME/.log/last.txt)
else
file=$(cat /home/$1/.log/last.txt)
fi
tail -f $file
exit 0