sample crontab file

This commit is contained in:
brmbar 2018-04-02 01:40:37 +02:00
parent 1f3f1cdd8f
commit e2e6632df0
3 changed files with 24 additions and 0 deletions

15
brmbar3/crontab Normal file
View file

@ -0,0 +1,15 @@
# cleanup bounty
*/5 * * * * ~/brmbar/brmbar3/uklid-watchdog.sh
0 0 * * 1 ~/brmbar/brmbar3/uklid-refill.sh
# overall summary
5 4 * * * ~/brmbar/brmbar3/daily-summary.sh | mail -s "daily brmbar summary" yyy@yyy
# debt track
5 0 * * * ~/brmbar/brmbar3/dluhy.sh 2>/dev/null
# per-user summary
1 0 * * * /home/brmlab/brmbar/brmbar3/log.sh yyy yyy@yyy
# backup
6 * * * * echo "SELECT * FROM account_balances;" | psql brmbar | gzip -9 | ssh -Tp 110 -i /home/brmlab/.ssh/id_ecdsa jenda@coralmyn.hrach.eu
16 1 * * * pg_dump brmbar | gzip -9 | ssh -Tp 110 -i /home/brmlab/.ssh/id_ecdsa jenda@coralmyn.hrach.eu

3
brmbar3/dluhy.sh Executable file
View file

@ -0,0 +1,3 @@
p1=`echo -n "brmbar - dluhy: "; echo "SELECT name, crbalance FROM account_balances WHERE acctype = 'debt' AND crbalance < -100 AND name NOT LIKE '%overflow%' AND name NOT LIKE 'sachyo' ORDER BY crbalance ASC" | psql brmbar | tail -n +3 | grep '|' | tr -s " " | sed -e "s/ |/:/g" -e "s/$/;/" | tr -d "\n"`
p2=`echo "SELECT sum(crbalance) FROM account_balances WHERE acctype = 'debt' AND crbalance < 0 AND name NOT LIKE '%overflow%' AND name NOT LIKE 'sachyo'" | psql brmbar | tail -n +3 | head -n 1 | tr -s " "`
echo "$p1 total$p2 Kc" | ssh -p 110 -i /home/brmlab/.ssh/id_rsa jenda@coralmyn.hrach.eu

6
brmbar3/log.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
p=`/home/brmlab/brmbar/brmbar3/brmbar-cli.py userlog "$1" yesterday`
if [ -n "$p" ]; then
echo "$p" | mail -s "brmbar report" "$2"
fi