簡體   English   中英

在啟動腳本linux中運行lap-request

[英]running lap-request in startup script linux

我在Linx的啟動中運行啟動腳本:

/ etc / init / selfconfig

#! /bin/sh  
# /etc/init.d/selfconfig

USER=root
HOME=/root

export USER HOME

/usr/bin/perl /boot/coder_settings/saconfig.pl

exit 0

該腳本運行一個perl腳本

/boot/coder_settings/saconfig.pl

#! /usr/bin/perl

lwp-request -m GET http://192.168.1.16:3000/hostname > /boot/coder_settings/hostname.txt

但是我得到這個錯誤:

Search pattern not terminated at /boot/coder_settings/saconfig.pl line 3.

我究竟做錯了什么?

盡管lwp-request是一個perl腳本,但它被設置為作為命令行程序運行。

您只需更改bash腳本即可;

#! /bin/sh 
....
/usr/bin/perl /boot/coder_settings/saconfig.pl

至;

#! /bin/sh 
....
lwp-request -m GET http://192.168.1.16:3000/hostname > /boot/coder_settings/hostname.txt

如果要將lwp-request作為來自perl的shell命令運行,請使用反引號將perl腳本更改為;

#! /usr/bin/perl

`lwp-request -m GET http://192.168.1.16:3000/hostname > /boot/coder_settings/hostname.txt`

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM