Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reboot aterm router (ATERM-DD3B55)
#!/bin/sh
# @(#) Reboot aterm router.
# @(#) shell script version: 20191202
# @(#) Test router is ATERM-DD3B55 (FW: 1.8.56)
user=YOUR_USERNAME
pass=YOUR_PASSWORD
domain=http://192.168.0.1
path=index.cgi/reboot_main_set
url=$domain/$path
# Get session id
session_id=$(curl -s --basic -u $user:$pass $url \
| grep -m 1 "<input type='hidden' id='SESSION_ID' name='SESSION_ID'" \
| sed -e "s/<input type='hidden' id='SESSION_ID' name='SESSION_ID' value='//g" -e "s/' \/>//g")
# echo session_id: $session_id
# Reboot aterm router
curl -s -o /dev/null -F "SESSION_ID=$session_id" --basic -u $user:$pass $url
echo Please wait few sec
sleep 5
curl --connect-timeout 60 --max-time 120 -# -o /dev/null https://google.com
echo "Reboot succeeded!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.