Squid is already there, and it is enabled. But that is not the issue.
Actually squid starts automatically at boot, only 3 minutes after the login screen. That is unacceptable, I just can’t wait 3 minutes each time before I get access to Internet.
I don’t know why it takes so long, and I don’t really care. As a workaround, I would like that flowing is executed immediately after login.
su
service squid start
I’m doing this manually, and I’m getting tired of starting up terminal window and typing this each time, over and over again.
(Besides my girlfriend does not know the root password, so she must wait 3 minutes before she can start using FireFox).
Can I write something in .bashrc that does this for me?
In /etc/init.d/boot.local, there is a line that says:
Here you should add things, that should happen directly after booting
before we’re going to the first run level.
Probably, starting squid that early (before run level 1) is not effective.
I suppose that ideal time to start squid is after the wireless connection is established, which happens after I unlock the keyring (WEP code is locked by the keyring).
Is there a way to lock/unlock squid service with keyring as well?
by putting squid in boot.local it is started before your network and apache are up, thus it won’t work as boot.local executes stuff before network service is up and squid needs to be started after network is up and after apache is up
Not sure about your strange bahavior of squid. Works here without such a long delay. I don’t see anything wrong with the bootscript of squid that can cause such a delay
@blnl: You haven’t explained what kind of network connection you have, whether it’s made with ifup or by networkmanager. Squid really works best with a fixed IP connection. If you are going to be running it on a machine with a dynamic IP assignment, then you need to start it after the connection has been made and DNS resolution is available.
@ken_yap: My network connection is made by the Network Manager (IP obtained by DHCP). My modem is running DHCP server, but the IP addresses are fixed to MAC addresses. So, in fact each PC gets a fixed IP address. However, the network will connect only after the keyring pasword is entered (somehow my WEP key got into the keyring, and I never succeded in fixing this).
@swerdna: What is a “root crontable”?
Sorry, I’m new to Linux.
A cron table is a table of entries for tasks you want to have performed, at regular intervals or upon booting. A root cron table performs the tasks in the name of the root user. A standard cron table perofrms the task in the name of the user who owns the table (it’s a text file). The line of code I wrote says essentially: “at boot time, wait 10 seconds and then restart the squid service as root”.
Ok, what you might want to do is have the interface up event trigger the starting of the squid service so that the network and DNS are ready and squid doesn’t hang because of unavailability of those.
Unfortunately this is an advanced topic, but what you have to do is to write a script to go into /etc/sysconfig/network/if-up.d. There are a couple of existing scripts there you can use as a guideline. The script receives the interface name as the second argument so you make it check for the right interface before you do anything.
A corresponding down script can be put in /etc/sysconfig/network/if-down.d as you would expect. In fact the same script can be two-faced, by having it check its own pathname and doing the up action or the down action depending. That’s why the existing scripts are actually symlinks to the actual script in /etc/sysconfig/network/scripts/.
Crontable sounds as a nice workaround. First I’ll try using the crontable for starting squid service, until I learn how to write a script with interface up event trigger (which seems as more elegant solution).