1*4882a593Smuzhiyun#!/bin/sh
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun# prepare testing config
5*4882a593SmuzhiyunCONF_USERS=`readlink -f /etc/raddb/users`
6*4882a593Smuzhiyunmv ${CONF_USERS} ${CONF_USERS}_orig
7*4882a593Smuzhiyunecho "testing Cleartext-Password := \"testpassword\"" > ${CONF_USERS}
8*4882a593Smuzhiyuncat ${CONF_USERS}_orig >> ${CONF_USERS}
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun# restart radiusd server
11*4882a593Smuzhiyunsystemctl restart radiusd || /etc/init.d/radiusd restart || {
12*4882a593Smuzhiyun        echo "FAIL: Start radiusd service."
13*4882a593Smuzhiyun        exit 1
14*4882a593Smuzhiyun}
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun# run teests
17*4882a593Smuzhiyunperl test.pl
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun# restore the config and restart
20*4882a593Smuzhiyunmv ${CONF_USERS}_orig ${CONF_USERS}
21*4882a593Smuzhiyunsystemctl restart radiusd || /etc/init.d/radiusd restart
22