Step 1. Cearting a Shell Script

IOU_Lession3.sh:
#!/bin/bash
#
# Creating 5 routers:
# R10 (Port #2001): e0/0-3 e1/0-3 s2/0-3
# R20 (Port #2002): s0/0-3 s1/0-3
# R30 (Port #2003): s0/0-3
# R40 (Port #2004): e0/0-3 e1/0-3 s2/0-3
# R50 (Port #2005): e0/0-3 e1/0-3 e2/0-3
#
# History:
# 2011/02/09 by Happy Peter
# http://blog.xuite.net/juilin77/happy
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#
#R10
/home/peter/iou/wrapper-linux -m ~/iou/i86bi_linux-adventerprisek9-ms -p 2001 -- -e 2 -s 1 10 &
sleep 1s
#R20
/home/peter/iou/wrapper-linux -m ~/iou/i86bi_linux-adventerprisek9-ms -p 2002 -- -e 0 -s 2 20 &
sleep 1s
#R30
/home/peter/iou/wrapper-linux -m ~/iou/i86bi_linux-adventerprisek9-ms -p 2003 -- -e 0 -s 1 30 &
sleep 1s
#R40
/home/peter/iou/wrapper-linux -m ~/iou/i86bi_linux-adventerprisek9-ms -p 2004 -- -e 2 -s 1 40 &
sleep 1s
#R50
/home/peter/iou/wrapper-linux -m ~/iou/i86bi_linux-adventerprisek9-ms -p 2005 -- -e 3 -s 0 50 &
sleep 1s
#
exit 0
Step 2. Changing the Shell Script permissions.

Step 3. Running the Shell Script.

Step 4. Telnet to routers and enjoy it \(^3^)/

Step 5. Stoping this process
$ ps -ef | grep [w]rapper | awk '{ print $2 }' | xargs kill

Step 6. Creating a Shell Scripts for this long command and then changing that permissions.

stopIOU.sh:
#!/bin/bash
#
# Stop IOU Processes
#
# History:
# 2011/02/09 by Happy Peter
# http://blog.xuite.net/juilin77/happy
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#
ps -ef | grep [w]rapper | awk '{ print $2 }' | xargs kill
#
exit 0
Reference:
evilrouters.net http://evilrouters.net/
鳥哥的 Linux 私房菜 http://linux.vbird.org/
Thanks for "Le****e sir" (真。牛人)
最初發表 / 最後更新: 2011.02.09 / 2018.06.08
0 comments:
張貼留言