Skip to content

Instantly share code, notes, and snippets.

@Coro365
Created December 2, 2019 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coro365/3d32023f42202d13d10e9974a8da3a3e to your computer and use it in GitHub Desktop.
Save Coro365/3d32023f42202d13d10e9974a8da3a3e to your computer and use it in GitHub Desktop.
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