Solved

xinetd help

Posted on 2004-09-15
7
354 Views
Last Modified: 2010-03-18
I need a little help with setting up a backup for my Squid box. I have Squid setup in reverse proxy mode for a web site. I'm looking to setup a failover if the Squid service fails for any reason. I was told xinetd could help with this. I need something that checks that Squid, ports 80 and 443 are working. If not I need xinetd to fire up and pass the request to the backend server.

Can this be done? If so how would I do it? Or is there a better way?
0
Comment
Question by:GentooOS
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:pablouruguay
Comment Utility
you can use a simple bash script. i use this script for check my ip. modify and use it. is better i think.

you need to use crontab to check every  1 min example.

#!/bin/sh
while [ 1 ]; do
    HAVE_ADSL=`ifconfig ppp0 | grep -c 'error fetching interface information:
Device not found'`
    if [ "$HAVE_ADSL" -gt 0 ]; then
        /sbin/rcnetwork restart dsl0
    fi
    sleep 60
done
0
 

Author Comment

by:GentooOS
Comment Utility
Thanks pablouruguay.

I'm new to Linux and not sure what your bash script is doing.  Could you explain each line?   How would I use this method to check the squid service and that ports 80 and 443 are being accepted?

Thanks
0
 
LVL 14

Accepted Solution

by:
pablouruguay earned 500 total points
Comment Utility
#!/bin/sh
while [ 1 ]; do
    HAVE_ADSL=`netstat -a | grep -c https
    if [ "$HAVE_ADSL" -gt 0 ]; then
        /sbin/httpd restart
    fi
    sleep 60
done


and other

#!/bin/sh
while [ 1 ]; do
    HAVE_ADSL=`netstat -a | grep -c :httpd
    if [ "$HAVE_ADSL" -gt 2 ]; then
        /sbin/httpd restart dsl0
    fi
    sleep 60
done

if i wrong correct please......










0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:GentooOS
Comment Utility
what does -gt 0 and -gt 2 mean?

I'd like to start xinetd if Squid fails and forward ports 80 and 443 to the backend server as squid would most likely fail again after restart.

Thanks.
0
 
LVL 14

Expert Comment

by:pablouruguay
Comment Utility
the output of grep command


i cant understand "WHY" xinetd... if you like to forward ports you need iptables.  NOT xinetd
0
 

Author Comment

by:GentooOS
Comment Utility
OK, Could you help me doing this with using iptables?
0
 
LVL 14

Expert Comment

by:pablouruguay
Comment Utility
mmmm i dont think so... jlevie, redimidio or owens  are the correct guys for this job,  they understan much better iptables than me sorry
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now