113 lines
2.8 KiB
Bash
113 lines
2.8 KiB
Bash
#!/bin/bash
|
||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin;
|
||
module_dir="/root/amh/modules/AMProxy-2.0/";
|
||
|
||
#info
|
||
function amh_module_info()
|
||
{
|
||
echo 'AMH-ModuleName: AMProxy-2.0';
|
||
echo 'AMH-ModuleDescription: AMProxy-2.0 反向代理模块修改版(用于API兼容HYProxy)';
|
||
echo 'AMH-ModuleButton: 安装/卸载';
|
||
echo 'AMH-ModuleDate: 2020-01-17';
|
||
echo 'AMH-ModuleAdmin: ./index.php?c=amproxy';
|
||
echo 'AMH-ModuleWebSite: http://www.huayizhiyun.com';
|
||
echo 'AMH-ModuleScriptBy: HITSword.';
|
||
}
|
||
|
||
#install
|
||
function amh_module_install()
|
||
{
|
||
if amh_module_status ; then
|
||
exit;
|
||
else
|
||
if [ ! -f "/root/amh/modules/HYProxy-1.0/InstallComplete" ]; then
|
||
echo '[Error] HYProxy 未安装.';
|
||
exit;
|
||
fi;
|
||
touch ./InstallComplete;
|
||
amh_module_status;
|
||
fi;
|
||
}
|
||
|
||
#uninstall
|
||
function amh_module_uninstall()
|
||
{
|
||
if amh_module_status ; then
|
||
rm -f /root/amh/modules/AMProxy-2.0/InstallComplete;
|
||
echo '[OK] AMProxy-2.0 Uninstall successful.';
|
||
else
|
||
exit;
|
||
fi;
|
||
}
|
||
|
||
#admin
|
||
function amh_module_admin()
|
||
{
|
||
if amh_module_status ; then
|
||
param_list=${1//,/ };
|
||
set -- $param_list;
|
||
action=$1;
|
||
domain=$2;
|
||
|
||
if [ "$action" == '' ]; then
|
||
echo "[Notice] AMProxy management, please select: (1~4)"
|
||
select action in 'list' 'add' 'start' 'stop' 'edit' 'del' 'start-cache' 'stop-cache' 'cache' 'cache-index' 'cache-delete'; do
|
||
break;
|
||
done;
|
||
fi;
|
||
|
||
case $action in
|
||
list)
|
||
echo "list something";
|
||
;;
|
||
start)
|
||
echo "start something";
|
||
;;
|
||
stop)
|
||
echo "stop something";
|
||
;;
|
||
add)
|
||
echo "add something";
|
||
;;
|
||
edit)
|
||
echo "edit something";
|
||
;;
|
||
del)
|
||
echo "del something";
|
||
;;
|
||
start-cache)
|
||
echo "start cache";
|
||
;;
|
||
stop-cache)
|
||
echo "stop cache";
|
||
;;
|
||
cache)
|
||
echo "[Notice] 暂不支持缓存配置";
|
||
;;
|
||
cache-index)
|
||
echo "[Notice] 暂不支持缓存索引";
|
||
;;
|
||
cache-delete)
|
||
echo "[Notice] 暂不支持缓存删除";
|
||
;;
|
||
*)
|
||
echo "[Notice] 无效操作";
|
||
;;
|
||
esac
|
||
else
|
||
exit;
|
||
fi;
|
||
}
|
||
|
||
|
||
#status
|
||
function amh_module_status()
|
||
{
|
||
if [ -f "/root/amh/modules/AMProxy-2.0/InstallComplete" ]; then
|
||
echo '[OK] AMProxy-2.0 is already installed.';
|
||
return 0;
|
||
else
|
||
echo '[Notice] AMProxy-2.0 is not installed.';
|
||
return 1;
|
||
fi;
|
||
} |