Solved

xinetd help

Posted on 2004-09-15
7
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:pablouruguay
ID: 12065940
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
ID: 12067231
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
ID: 12067961
#!/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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

Author Comment

by:GentooOS
ID: 12068159
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
ID: 12068426
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
ID: 12068458
OK, Could you help me doing this with using iptables?
0
 
LVL 14

Expert Comment

by:pablouruguay
ID: 12068608
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

729 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