|
|
|
@@ -1,11 +1,17 @@ |
|
|
|
#!/bin/bash -x |
|
|
|
|
|
|
|
set -e |
|
|
|
|
|
|
|
usage() |
|
|
|
{ |
|
|
|
echo "Usage: $0 [-h ] [ -s website ] [ -l | -v | -u userid ]" >&2 |
|
|
|
exit 1 |
|
|
|
echo "Usage: $0 [-h ] [ -s domain ] [ -l | -v | -u userid ]" >&2 |
|
|
|
exit 0 |
|
|
|
} |
|
|
|
|
|
|
|
if [ $# -lt 3 ]; then |
|
|
|
echo "not enough arguments" |
|
|
|
usage |
|
|
|
fi |
|
|
|
|
|
|
|
while getopts ":hs:lu:v" opt; |
|
|
|
do |
|
|
|
@@ -13,10 +19,10 @@ do |
|
|
|
h) |
|
|
|
echo "Usage:" |
|
|
|
echo " $0 -h Display this help message." |
|
|
|
echo " $0 -s <website> The website is a mandatory argument." |
|
|
|
echo " $0 -s <website> -l List WordPress users." |
|
|
|
echo " $0 -s <website> -v Display the WordPress version" |
|
|
|
echo " $0 -s <website> -u <userid> Generate and set a random password for this WordPress userid." |
|
|
|
echo " $0 -s <domain> The website is a mandatory argument." |
|
|
|
echo " $0 -s <domain> -l List WordPress users." |
|
|
|
echo " $0 -s <domain> -v Display the WordPress version" |
|
|
|
echo " $0 -s <domain> -u <userid> Generate and set a random password for this WordPress userid." |
|
|
|
exit 0 |
|
|
|
;; |
|
|
|
s) |
|
|
|
@@ -51,7 +57,6 @@ fi |
|
|
|
|
|
|
|
# declaration section |
|
|
|
|
|
|
|
|
|
|
|
# functions section |
|
|
|
|
|
|
|
check_err() |
|
|
|
@@ -65,6 +70,10 @@ check_err() |
|
|
|
|
|
|
|
function get_sysuser() { |
|
|
|
SYSUSER=`ls -l /var/www/ | awk '$9 ~ /^'${WEB}'$/ { print $11 }' | awk -F'/' '{ print $6 }'` |
|
|
|
if [ -z ${SYSUSER} ]; then |
|
|
|
echo "SYSUSER contains nothing!" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
echo ${SYSUSER} |
|
|
|
} |
|
|
|
|
|
|
|
|