2017-04-06 60 views
1

我想通過SSH將頻率掃描列表添加到無處不在的設備。 這裏是我使用的代碼:編輯無處不在/temp/system.cfg文件

grep -v "wireless.1.scan_list" /tmp/system.cfg > /tmp/tempconfig 
echo  "wireless.1.scan_list.channels=5150,5155,5160,5165,5170,5175,5180,5185,5190,5195,5200,5205,5210,5215,5220,5225,5230,5235,5240,5245,5250,5255,5260,5265,5270,5275,5280,5285,5290,5295,5300,5305,5310,5315,5320,5325,5330,5335,5340,5345,5350,5355,5360,5365,5370,5375,5380,5385,5390,5395,5400,5405,5410,5415,5420,5425,5430,5435,5440,5445,5450,5455,5460,5465,5470,5475,5480,5485,5490,5495,5500,5505,5510,5515,5520,5525,5530,5535,5540,5545,5550,5555,5560,5565,5570,5575,5580,5585,5590,5595,5600,5605,5610,5615,5620,5625,5630,5635,5640,5645,5650,5655,5660,5665,5670,5675,5680,5685,5690,5695,5700,5705,5710,5715,5720,5725,5730,5735,5740,5745,5750,5755,5760,5765,5770,5775,5780,5785,5790,5795,5800,5805,5810,5815,5820,5825,5830,5835,5840,5845,5850,5855,5860,5865,5870,5875" >> /tmp/tempconfig 

echo "wireless.1.scan_list.status=enabled" >> /tmp/tempconfig 

mv /tmp/tempconfig /tmp/system.cfg 
save 
/usr/etc/rc.d/rc.softrestart save 

唯一的問題是,當我貼吧,「回聲‘wireless.1.scan_list.channels’命令是不完整的(最有可能是由於一些字符門檻然後當我通過http登錄到設備時,我只看到了第二批數字

我將更新大約6000個設備所以這就是爲什麼我不能通過瀏覽器手動執行此操作。請指教...

回答

0

剛剛斷線:

grep -v "wireless.1.scan_list" /tmp/system.cfg > /tmp/tempconfig 
printf "wireless.1.scan_list.channels=5150,5155,5160,5165,5170,5175,5180,5185,5190," > /tmp/tempconfig 
printf "5195,5200,5205,5210,5215,5220,5225,5230,5235,5240,5245,5250,5255,5260,5265," >> /tmp/tempconfig 
printf "5270,5275,5280,5285,5290,5295,5300,5305,5310,5315,5320,5325,5330,5335,5340," >> /tmp/tempconfig 
printf "5345,5350,5355,5360,5365,5370,5375,5380,5385,5390,5395,5400,5405,5410,5415," >> /tmp/tempconfig 
printf "5420,5425,5430,5435,5440,5445,5450,5455,5460,5465,5470,5475,5480,5485,5490," >> /tmp/tempconfig 
printf "5495,5500,5505,5510,5515,5520,5525,5530,5535,5540,5545,5550,5555,5560,5565," >> /tmp/tempconfig 
printf "5570,5575,5580,5585,5590,5595,5600,5605,5610,5615,5620,5625,5630,5635,5640," >> /tmp/tempconfig 
printf "5645,5650,5655,5660,5665,5670,5675,5680,5685,5690,5695,5700,5705,5710,5715," >> /tmp/tempconfig 
printf "5720,5725,5730,5735,5740,5745,5750,5755,5760,5765,5770,5775,5780,5785,5790," >> /tmp/tempconfig 
printf "5795,5800,5805,5810,5815,5820,5825,5830,5835,5840,5845,5850,5855,5860,5865," >> /tmp/tempconfig 
printf "5870,5875\n" >> /tmp/tempconfig 
echo "wireless.1.scan_list.status=enabled" >> /tmp/tempconfig 

mv /tmp/tempconfig /tmp/system.cfg 
save 
/usr/etc/rc.d/rc.softrestart save 
+0

你是男人! –

+0

只是一件事...似乎「/usr/etc/rc.d/rc.softrestart保存」命令並沒有真正做到軟重置。有沒有一種方法可以在不重啓設備的情況下進行保存,因爲我有更多的任務需要在設備上完成,希望在完成所有工作後重啓。我應該編輯問題還是開始一個新問題? –

+0

@tsietsirampa我不知道,我不知道你到底在做什麼。這不是編程相關的,所以你可能想在[unix.se]上發佈一個問題。啊,同時,當我欣賞這種情緒時,請不要留下感謝的意見。相反,如果一個答案解決了你的問題,你可以[接受它](http://stackoverflow.com/help/someone-answers)。這將標誌着問題「解決」。 – terdon