check-blacklist.sh: Added script to check DNSBL blacklist
[mgsautils.git] / smf / smf_fetch_user_profile.sh
1 #!/bin/sh
2
3 if [ $# -lt 5 ]
4 then
5 echo "Usage: $0 <SMF database> <table prefix> <DB user> <password file> <SMF member ID>"
6 exit
7 fi
8
9 dbname=$1
10 dbpref=$2
11 dbuser=$3
12 dbpass=$4
13 smfidmember=$5
14
15 if [ "$(stat -c %A/%U ${dbpass})" != "-r--------/$(whoami)" ]
16 then
17 echo "Password file must have 400 permissions and must be owned by you! (And it must exist, by the way.)"
18 exit
19 fi
20
21 mysqlargs="--user=${dbuser} --password=$(cat ${dbpass}) --database=${dbname} --default-character-set=utf8"
22
23 echo SYSTEM INFO:
24 uname -a
25 echo
26 echo SYSTEM UPTIME:
27 uptime
28 echo
29 echo MYSQL VERSION:
30 /usr/sbin/mysqld --version
31 echo
32 echo DATABASE NAME:
33 echo ${dbname}
34 echo
35 echo SMF USER:
36 mysql ${mysqlargs} --batch --raw --skip-column-names --execute="SELECT id_member, member_name FROM ${dbpref}_members WHERE id_member = $smfidmember" | sed 's+\t+ / +'
37 echo
38 echo
39 echo User profile:
40 echo
41 mysql ${mysqlargs} --execute="SELECT * FROM ${dbpref}_members WHERE id_member = $smfidmember\G"
42 echo
43 echo
44 echo Custom profile settings:
45 echo
46 mysql ${mysqlargs} --execute="SELECT * FROM ${dbpref}_themes WHERE id_member = $smfidmember\G"