-
-
Save mohsinr/2e76e2997aaeb15782dd0f43cebcc458 to your computer and use it in GitHub Desktop.
Simple Bash Script to execute a command on the router through telnet command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# replace cmd1 for the command to execute | |
host=192.168.1.1 | |
port=23 | |
user=admin | |
pass=02B08 | |
cmd1='adsl info' | |
current_date_time="`date +%Y-%m-%d\ %H:%M:%S`"; | |
( echo open ${host} | |
sleep 1 | |
echo ${user} | |
sleep 1 | |
echo ${pass} | |
sleep 1 | |
echo ${cmd1} | |
sleep 2 | |
) | telnet | tee -a txt.txt | |
echo $current_date_time | tee -a txt.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment