You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
992 B
46 lines
992 B
5 years ago
|
#!/usr/bin/env bash
|
||
5 years ago
|
|
||
|
help_message(){
|
||
|
echo 'Command [PASSWORD]'
|
||
5 years ago
|
echo 'Example: webadmin.sh mypassword'
|
||
|
echo 'Command [-r]'
|
||
|
echo 'Example: webadmin.sh -r'
|
||
|
echo 'Will restart LiteSpeed Web Server'
|
||
5 years ago
|
exit 0
|
||
|
}
|
||
|
|
||
|
check_input(){
|
||
|
if [ -z "${1}" ]; then
|
||
|
help_message
|
||
|
exit 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
set_web_admin(){
|
||
|
docker-compose exec litespeed su -s /bin/bash lsadm -c \
|
||
|
'echo "admin:$(/usr/local/lsws/admin/fcgi-bin/admin_php* -q /usr/local/lsws/admin/misc/htpasswd.php '${1}')" > /usr/local/lsws/admin/conf/htpasswd';
|
||
|
}
|
||
|
|
||
5 years ago
|
lsws_restart(){
|
||
|
docker-compose exec litespeed su -c '/usr/local/lsws/bin/lswsctrl restart'
|
||
|
}
|
||
|
|
||
5 years ago
|
main(){
|
||
5 years ago
|
set_web_admin ${1}
|
||
5 years ago
|
}
|
||
|
|
||
|
check_input ${1}
|
||
|
while [ ! -z "${1}" ]; do
|
||
|
case ${1} in
|
||
|
-[hH] | -help | --help)
|
||
|
help_message
|
||
5 years ago
|
;;
|
||
|
-[rR] | -restart | --restart)
|
||
|
lsws_restart
|
||
|
;;
|
||
5 years ago
|
*)
|
||
5 years ago
|
main ${1}
|
||
5 years ago
|
;;
|
||
|
esac
|
||
|
shift
|
||
|
done
|