页次: 1
#!/usr/bin/bash
while true ; do
ip=$(($RANDOM/220+2))
ip_dst="192.168.0."$ip
ping -c 1 $ip_dst > /dev/null
if [ $? -gt 0 ]
then
break;
fi
done
profile="/etc/netctl/here"
profile_temp="/tmp/here.profile"
profile_body=`cat /etc/netctl/examples/here`
echo "$profile_body" > $profile_temp
echo "Address='$ip_dst/24'" >> $profile_temp
if [ ! -L "$profile" ]; then
ln -sf $profile_temp $profile
fi
exit 0
定时器
[android:/etc/systemd/system] cat ip.timer
[Unit]
Description=Run Every 15min
[Timer]
OnCalendar=*:0/15
[Install]
WantedBy=timers.target.wants
[android:/etc/systemd/system] cat ip.service
[Unit]
Description=Automatic wireless network connection using here profiles
[Service]
ExecStartPre=-/usr/bin/here
ExecStart=/usr/bin/netctl restart here
Type=simple
[Install]
WantedBy=multi-user.target
最近编辑记录 wxg4net (2016-12-02 08:54:05)
Arch Linux User
离线
页次: 1