check-blacklist.sh: Added script to check DNSBL blacklist
[mgsautils.git] / smf / check_smf_pending_users.sh
1 #!/bin/sh
2
3 if [ $# -lt 4 ]
4 then
5 echo "Usage: $0 <SMF database> <table prefix> <DB user> <password file>"
6 exit
7 fi
8
9 dbname=$1
10 dbpref=$2
11 dbuser=$3
12 dbpass=$4
13
14 if [ "$(stat -c %A/%U ${dbpass})" != "-r--------/$(whoami)" ]
15 then
16 echo "Password file must have 400 permissions and must be owned by you! (And it must exist, by the way.)"
17 exit
18 fi
19
20 mysqlargs="--user=${dbuser} --password=$(cat ${dbpass}) --database=${dbname} --default-character-set=utf8 --table"
21
22 echo SYSTEM INFO:
23 uname -a
24 echo
25 echo SYSTEM UPTIME:
26 uptime
27 echo
28 echo MYSQL VERSION:
29 /usr/sbin/mysqld --version
30 echo
31 echo DATABASE NAME:
32 echo ${dbname}
33 echo
34 echo
35 echo Users awaiting approval:
36 echo
37 mysql ${mysqlargs} --execute="SELECT id_member, member_name, email_address, FROM_UNIXTIME(date_registered) FROM ${dbpref}_members WHERE is_activated=3 ORDER BY date_registered DESC;"
38 echo
39 echo
40 echo Approved users with zero posts:
41 echo
42 mysql ${mysqlargs} --execute="SELECT id_member, member_name, email_address, FROM_UNIXTIME(date_registered), FROM_UNIXTIME(last_login) FROM ${dbpref}_members WHERE is_activated=1 AND posts=0 ORDER BY date_registered"