优盘授权管理
此处就整个过程的一部分脚本,api以及其他功能省略,此处就是大概的获得凭证以及验证的过程
#!/bin/bash
#设置变量
confString=''
#检测网络链接畅通
function network()
{
#超时时间
local timeout=1
#目标网站
local target=www.baidu.com
#获取响应状态码
local ret_code=`curl -I -s --connect-timeout ${timeout} ${target} -w %{http_code} | tail -n1`
if [ "x$ret_code" = "x200" ]; then
#网络畅通
return 1
else
#网络不畅通
return 0
fi
return 0
}
#获取配置文件
function getConf()
{
sn=$1
conf=`curl -X POST http://192.168.43.197:90/api/getconf/{$sn}`
if [ `echo \"$conf\" | grep $sn | wc -l` -gt 0 ];then
confString=$conf
return 1
fi
return 0
}
# 设置VPN,填写脚本
function setVpn()
{
parameters=$1
echo $parameters
# 设置省略一些代码
return 1
}
#卸载不必要的软件
#`rm -rf /etc/apt/sources.list.d/systemback.list