Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-28-2008, 01:00 AM   #1
Registered: Oct 2006
Posts: 46

Rep: Reputation: 15
using wget to download a cgi file


I wrote a cgi file, HTTPD_ROOT/cgi-bin/lock.cgi, in target PC
in order to run some command on the target PC :


sem=`cat /var/lock/semaphore`
echo -n $sem > /var/lock/semaphore

/bin/pidof rsyncmon > /dev/null
if [ $? -eq 0 ]; then
echo "Already running: rsyncmon"
return 0
/usr/local/bin/rsyncmon &

return 0
and I ran wget on my PC :

then I could get the output - /var/lock/semaphore - on target PC
but it failed to download the cgi file, lock.cgi :

~# wget http://x.x.x.x/cgi-bin/lock.cgi
--14:31:11-- http://x.x.x.x/cgi-bin/lock.cgi
=> `lock.cgi'
Connecting to x.x.x.x:80... connected.
HTTP request sent, awaiting response...
NO response infinitely...

Any advice to download successfully?
Thanks in advance.
Old 03-29-2008, 10:37 AM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
As part of the server, your CGI must send a proper HTTP response header. A useful HTML reply of some sort would be good as well.
Example (untested):
    echo "Content-type: text/html"
    echo "<HTML>"
    echo "<HEAD>"
    echo "<TITLE>LOCK CGI</TITLE>"
    echo "</HEAD>"
    echo "<BODY>"
    echo "Something useful here...."
    echo "</BODY></HTML>"
--- rod.

Last edited by theNbomr; 03-29-2008 at 10:38 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
wget and slackware download ivanatora Slackware 4 01-12-2008 05:12 AM
wget Download Oracle Kryptos Linux - Software 1 01-01-2008 12:08 PM
Script to download file using wget linuxnewbie82 Programming 6 02-14-2007 04:48 AM
wget wont download ?? paul_mat Linux - Software 1 11-01-2005 12:45 AM
what to do with 5 parts of wget download Bruce Hill Linux - Software 2 09-11-2003 10:47 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration