Hi,

I want to upload a file recursively using curl command, the file is in the directory where i am running the script

here is the details

1) The file rss.txt is in this directory
[ashok@qa-adm-001 rss]$ pwd
/home/ashok/rss

2) If i run POST request as a command, the file is uploaded
[ashok@qa-adm-001 rss]$ POST "http://qa-web-001.sjc1.yumenetworks.com/rsspush/processFeed?domain_id=930" < rss.txt
Success

3) When i try this in script; no error says success. But the file is not uploaded

[ashok@qa-adm-001 rss]$ cat param.sh
url="http://qa-web-001.sjc1.yumenetworks.com/rsspush/processFeed?domain_id=930"
for ((i=1;i<=$1;i++))
{
curl --silent POST $url < rss.txt
echo $i
}

[ashok@qa-adm-001 rss]$ ./param.sh 2
Success
1
Success
2

Could some one help on this where it lack..?

thanks in advance!
Ashok

Try quoting the input to curl:

curl --silent POST "${url}" < rss.txt

That is the only thing I see different

The webserver might be getting mad at you for making the requests too quickly. Try adding a "sleep 5" in your script to give the server a chance to breathe. Other than that I am not sure :(

hey sknake, i tried the following,
It works good

mysql --host=host_name --user=user_name --password=pwd --database=dbname --execute="\! POST "http://qa-web-001.sjc1.yumenetworks.com/rsspush/processFeed?domain_id=xxx" < output.txt"

FYI - Here the problem is the string "< output.txt" is not recognized when trying with curl; but if it is executed as MySql command in script, it accepts and uploading the file successfully

anyhow thanks for your updates
K. Ashok :)

hey sknake, i tried the following,
It works good

mysql --host=host_name --user=user_name --password=pwd --database=dbname --execute="\! POST "http://qa-web-001.sjc1.yumenetworks.com/rsspush/processFeed?domain_id=xxx" < output.txt"

FYI - Here the problem is the string "< output.txt" is not recognized when trying with curl; but if it is executed as MySql command in script, it accepts and uploading the file successfully

anyhow thanks for your updates
K. Ashok :)

Hello Sknake,

I have script like this

for ((loop=1;loop<=10;loop++))
{
curl --silent "http://qa-web-001.sjc1.yumenetworks.com/dynamic_preroll_playlist.xml?domain=xxxx" > rem1.log
echo $loop
}

It will make 10 sequential request, Is it possible to make concurrent 10 request as a thread using shell /bin/bash

your update is valuable,
thanks in advance
K. Ashok :)

You can use & to send it off in to the background.

sk@sk:~$ ./ba.sh &
[1] 4662
sk@sk:~$
sk@sk:~$
sk@sk:~$ Wed Aug 12 16:23:34 EDT 2009

[1]+  Done                    ./ba.sh
sk@sk:~$ cat ba.sh
#!/bin/bash
sleep 5
date
This article has been dead for over six months. Start a new discussion instead.