34 lines
616 B
Bash
Executable file
34 lines
616 B
Bash
Executable file
#!/bin/bash
|
|
# lists what playbooks/processes have happened today
|
|
# takes 2 optional arguments: date string, playbook name
|
|
# examples:
|
|
# ./loglist
|
|
# ./loglist yesterday
|
|
# ./loglist "last friday"
|
|
# ./loglist yesterday mirrorlist
|
|
|
|
logpath='/var/log/ansible'
|
|
|
|
when='yesterday'
|
|
if [ -n "$1" ]; then
|
|
when=$1
|
|
fi
|
|
|
|
ts=`date -d "$when" +%Y/%m/%d`
|
|
|
|
if [ -z "$2" ]; then
|
|
for dir in $logpath/*/$ts; do
|
|
if [ -d $dir ]; then
|
|
echo $dir
|
|
fi
|
|
done
|
|
exit;
|
|
fi
|
|
|
|
if [ -d $logpath/$ts/$2 ]; then
|
|
find $logpath/$2/$ts -mindepth 1 -maxdepth 1 -type d -print
|
|
else
|
|
echo "No such playbook log: $2"
|
|
exit 1
|
|
fi
|
|
|