编辑ubiquity /temp/system.cfg文件

时间:2017-04-06 11:42:06

标签: bash unix ubiquity

我想通过SSH将频率扫描列表添加到普遍存在的设备中。 这是我正在使用的代码:

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

唯一的问题是,当我粘贴它时," echo" wireless.s.scan_list.channels"命令不完整(最可能是设备上的字符数阈值)。然后我试着把命令分成两部分。这在CMD方面取得了成功,但当我通过http登录设备时,我只看到了第二批数字。

我要更新大约6000台设备,这就是为什么我不能通过浏览器手动执行此操作。请指教......

1 个答案:

答案 0 :(得分: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