Discussion:
[Freeswitch-users] Problem with X-PRE-PROCESS cmd="exec" and recursive wget
Victor Chukalovskiy
2013-11-06 21:26:14 UTC
Permalink
Greetings,

I need to grab content of all .xml files in a dir recursively with wget.
My test folder contains context1.xml and context2.xml. I do the
following in freeswitch.xml:

<X-PRE-PROCESS cmd="exec" data="wget -r -l 1 -np -nd -A xml -q -O -
ftp://myhost/"/>
Problem: it does not insert any lines after I "reloadxml" and check in
freeswitch.xml.fsxml

If I run the same from terminal wget returns lines that I expect:
[victor at hostname]# wget -r -l 1 -np -nd -A xml -q -O - ftp://myhost/
<context name="context1">
</context>
<context name="context2">
</context>
[victor at hostname]#

So, I'm puzzled why FS does not pick-up what "wget -r" writes into
stdout? Or does it? :-)

For comparison, X-PRE-PROCESS works with the same files requested
non-recursively:
<X-PRE-PROCESS cmd="exec" data="wget -q -O - ftp://myhost/context1.xml"/>
<X-PRE-PROCESS cmd="exec" data="wget -q -O - ftp://myhost/context2.xml"/>

Thank you,
Victor
Victor Chukalovskiy
2013-11-06 22:43:05 UTC
Permalink
Ok, figured it out. What happens is that wget tries to create temporary
.listing file and fails:

Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /myhost/ ... done.
==> PASV ... done. ==> LIST ... done.
.listing: Permission denied

When I run "reloadxml" wget is started as a non-root user and it tries
to create .listing in the filesystem root.

Fixed by changing directory before running wget:

<X-PRE-PROCESS cmd="exec" data="cd /user/local/freeswitch && wget -r -l
1 -np -nd -A xml -q -O - ftp://myhost/"/>
Post by Victor Chukalovskiy
Greetings,
I need to grab content of all .xml files in a dir recursively with
wget. My test folder contains context1.xml and context2.xml. I do the
<X-PRE-PROCESS cmd="exec" data="wget -r -l 1 -np -nd -A xml -q -O -
ftp://myhost/"/>
Problem: it does not insert any lines after I "reloadxml" and check in
freeswitch.xml.fsxml
[victor at hostname]# wget -r -l 1 -np -nd -A xml -q -O - ftp://myhost/
<context name="context1">
</context>
<context name="context2">
</context>
[victor at hostname]#
So, I'm puzzled why FS does not pick-up what "wget -r" writes into
stdout? Or does it? :-)
For comparison, X-PRE-PROCESS works with the same files requested
<X-PRE-PROCESS cmd="exec" data="wget -q -O -
ftp://myhost/context1.xml"/>
<X-PRE-PROCESS cmd="exec" data="wget -q -O -
ftp://myhost/context2.xml"/>
Thank you,
Victor
Loading...