Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-30-2007, 09:11 AM   #1
Registered: Jun 2001
Distribution: Gentoo
Posts: 150

Rep: Reputation: 19
uptime.cgi not working 100%

I'm trying to display uptime.cgi on my webserver. I'm using apache on fc6 64-bit. When the uptime.cgi gets called it displays everything correctly on the webpage except for # of users logged in. It always shows 0 as a value if if I have multiple users connected to my box via ssh or locally (tty and/or gui).

I did some debugging by running the bash script locally and it works fine. It shows the number of users logged in. I also checked who is running the script with whoami. When I run it locally in my shell its my current user and when its run on the web server its apache. So I also tried changing the user in httpd.conf to my user instead of apache and still got the same problem.

Here's a copy of my uptime.cgi in my /var/www/cgi-bin,
have any of you had this problem? I couldn't find anything at all related to this on google for the past week. Thanks.

echo "Content-type: text/html"
echo ""
echo "<html><head><title>Bash as CGI"
echo "</title></head><body>"
echo "</TITLE></HEAD><BODY><H1><CENTER>"
echo "Server Uptime for: <FONT COLOR=blue> linuxcore </FONT></H1>"
echo "<HR><BR><B><CENTER>"
echo `uptime`
echo "</B><BR><BR><HR><BR>"
echo "<A HREF="/index.html"> [ HOME ] </A><BR><BR>"
echo "Copyright (C) 2000, All Rights Reserved."
echo "</CENTER></BODY></HTML>"

note: I also tried $(uptime) instead of `uptime` and several other variations withtout success. And finally, someone in #fedora on told me that in fc6 gui users are not counted. So why would it work in the shell locally? And if I press control-shift-1 and log in a tty user is still doesnt count it via the webpage.

Sample output from the webpage:

10:11:07 up 9:34, 0 users, load average: 0.58, 0.55, 0.36

Sample output from the shell:

10:11:53 up 9:35, 2 users, load average: 0.43, 0.50, 0.35

Notice the # of users. Now this is the same script being run.


Last edited by cizzi; 03-30-2007 at 09:25 AM.
Old 03-30-2007, 05:35 PM   #2
Registered: Jun 2001
Distribution: Gentoo
Posts: 150

Original Poster
Rep: Reputation: 19
solution found!

Thanks to someone on #fedora on I now have a working solution. The problem turned out to be that SELinux was blocking the request from what I can understand. Disabling it solved the problem. Hope this can help someone else.



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
installing cgi perl to get lynx working hypnotiks Linux - Newbie 1 12-19-2004 02:06 PM
CGI not working in Apache shrey_j Programming 4 09-22-2004 12:28 AM
PERL not working - CGI? redhatbeatswin Linux - Newbie 3 07-17-2004 05:17 PM
CGI Does not seem to be working slimasian Linux - Newbie 1 08-19-2003 01:12 PM
ssi and cgi not working... Flawless Slackware 12 03-09-2003 09:38 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:55 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration