Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: How to start a program automaticaly at boot?

  1. #1
    Join Date
    Oct 2008
    Location
    The Netherlands
    Posts
    121

    Default How to start a program automaticaly at boot?

    I would like to start squid service at boot.

    Although squid service is turned on
    Code:
    chkconfig squid
    squid  on
    it takes full three minutes to start squid proxy after the login. That means waiting three minutes before I can get access to Internet.

    Instead of waiting for three minutes, I usually start squid manually as follows:
    Code:
    boris@DC7100:~> su
    Password: 
    DC7100:/home/boris # service squid start
    Starting WWW-proxy squid                                             done
    DC7100:/home/boris #
    Can I automate this, so that (see below) is always executed at startup, or when I start FireFox?
    Code:
    su
    service squid start
    And of course, how to do that?

    Thanks in advance,
    Boris
    openSUSE 11.0, GNOME
    HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
    HP Compaq DC7100, Intel Pentium 4 Processor 521, Intel 915G Express, D-Link DWL-510 AirPlus G

  2. #2
    Join Date
    Jun 2008
    Location
    /dev/swat
    Posts
    1,181

    Default Re: How to start a program automaticaly at boot?

    You can start it up when system started.
    Yast -> System -> System Services(Runlevel)

    But i m not sure, that squid will be there or not. Just give it a try.
    Linux[openSUSE, KDE], PHP, MySQL, Wordpress, Tech News, etc :
    http://anl4u.com

  3. #3
    Join Date
    Oct 2008
    Location
    The Netherlands
    Posts
    121

    Default Re: How to start a program automaticaly at boot?

    Thanks for the suggestion.

    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.
    Code:
    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?
    openSUSE 11.0, GNOME
    HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
    HP Compaq DC7100, Intel Pentium 4 Processor 521, Intel 915G Express, D-Link DWL-510 AirPlus G

  4. #4
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: How to start a program automaticaly at boot?

    Try putting the command in /etc/init.d/boot.local
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  5. #5
    Join Date
    Oct 2008
    Location
    The Netherlands
    Posts
    121

    Default Re: How to start a program automaticaly at boot?

    OK, I tried starting squid from /etc/init.d/boot.local

    Did it work? Yes and no!

    Squid is now started (on time as I asked for), still FireFox is not able to open any page. It keeps endlessly loading, but nothing happens.

    Unless I restart squid, FireFox can't open any page.
    Code:
    service squid restart
    openSUSE 11.0, GNOME
    HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
    HP Compaq DC7100, Intel Pentium 4 Processor 521, Intel 915G Express, D-Link DWL-510 AirPlus G

  6. #6
    Join Date
    Oct 2008
    Location
    The Netherlands
    Posts
    121

    Default Re: How to start a program automaticaly at boot?

    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?
    openSUSE 11.0, GNOME
    HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
    HP Compaq DC7100, Intel Pentium 4 Processor 521, Intel 915G Express, D-Link DWL-510 AirPlus G

  7. #7
    Join Date
    Jun 2008
    Location
    /dev/belgium
    Posts
    1,946

    Default Re: How to start a program automaticaly at boot?

    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

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: How to start a program automaticaly at boot?

    @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.

  9. #9
    Join Date
    Mar 2008
    Location
    Oz
    Posts
    11,731
    Blog Entries
    2

    Default Re: How to start a program automaticaly at boot?

    Putting this line in the root crontable will do it:
    Code:
    @reboot sleep 10;service squid restart
    You might have to adjust the 10. It's an inelegant but effective, efficacious and extremely easy expediency
    Leap 42.3 & 15.1 &KDE
    FYIs from the days of yore

  10. #10
    Join Date
    Oct 2008
    Location
    The Netherlands
    Posts
    121

    Default Re: How to start a program automaticaly at boot?

    @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.
    openSUSE 11.0, GNOME
    HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
    HP Compaq DC7100, Intel Pentium 4 Processor 521, Intel 915G Express, D-Link DWL-510 AirPlus G

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •