歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu下銳捷(ruijie)開機自動聯網程序

Ubuntu下銳捷(ruijie)開機自動聯網程序

日期:2017/2/28 16:54:38   编辑:Linux教程

在Ubuntu Linux下實現銳捷(ruijie)開機自動聯網程序,那麼首先需要安裝銳捷基本的客戶端xrgsu,然後編寫如下Tcl腳本:

#!/usr/bin/expect -f

spawn /home/promise/bin/xrgsu -a
expect "Please input your user name:"
send "Your Account\r"
expect "Please input your password:"
send "Your Password\r"
expect "Use DHCP,1-Use,0-UnUse(Default: 0):"
send "1\r"
expect "Please select which NIC will be used(0-1,Default:0)"
send '0\r'
expect "Use default auth parameter,0-Use 1-UnUse(Default: 0):"
send "0\r"
expect "Please input 'unauth' to LogOff:"
sleep 360000


保存為ruijie,隨後在/etc/rc.local中調用編寫的script,就可以實現。

說明:這個script會一直sleep,直到100小時後自動退出,如果rc.local中還有其他自啟動項目,則需要把這個script放在最後 。如此,開機後它就會一直存在,當然,它的父進程rc也會存在。

還有一種方案就是把script放入x-session執行,也就是加入會話管理,這樣的好處是rc不用被阻塞,但是不好的地方是如果x-session-manager崩潰,那麼銳捷進程也就被kill了。

Copyright © Linux教程網 All Rights Reserved