I compiled squid 3 from source and installed in /usr/local/squid/ on my debian jessie computer. I want to start squid at boot. The following code is my squid.service which located in /etc/systemd/system/squid.service

Description=Squid Proxy

ExecStart=/usr/local/squid/sbin/squid -f /usr/local/squid/etc/squid.conf -d1
ExecStop=/usr/local/squid/sbin/squid -k shutdown


Install at boot:

systemctl start squid
systemctl enable squid

But after restart. Squid is not run at boot.

  • 1
    This doesn't answer your question, but why not install the squid3 available in Debian 8 (Jessie)? Commented May 10, 2016 at 6:53
  • 1
    @StephenKitt I am trying to write my own systemd service to understand how a service works.
    – tkha
    Commented May 10, 2016 at 6:56
  • Are you using Networkmanager to manage the Network?
    – GAD3R
    Commented May 10, 2016 at 7:07
  • @GAD3R I installed a debian minimal. I did not install any Networkmanager packages.
    – tkha
    Commented May 10, 2016 at 7:12
  • @K.Lotus . What does journalctl -xn say to you right after you boot? Does it gives any clue why squid is not being started?
    – user34720
    Commented May 10, 2016 at 12:17

1 Answer 1


I think you need to create a daemon script then link a starter link on the required run level to start your squid.

For example:

cp /etc/init.d/skeleton /etc/init.d/squid

then implement start() & stop() and restart() if needed. Now you need to link the created daemon to the desired run level but make sure that it has a sequence number after networking or network-manager for example: if your desired run level is 5 cd /etc/rc5.d/ ls -l

you will find some thing like lrwxrwxrwx 1 root root 18 Jun 16 2015 S08iptables -> ../init.d/iptables lrwxrwxrwx 1 root root 17 Jun 16 2015 S10network -> ../init.d/network lrwxrwxrwx 1 root root 18 Jun 16 2015 S11netplugd -> ../init.d/netplugd So you need to run the following

ln -s /etc/init.d/squid /etc/rc5.d/S88squid

...... Restart your server and test

Please note that jessie debian has the two orientation of service management systemclt and the old daemon style.

  • The OP is looking for a systemd unit, not an initscript. Also, to link an initscript into the /etc/rc?.d tree you should use update-rc.d instead of linking files manually. Commented May 10, 2016 at 8:11
  • OP is looking to learn systemd units.
    – user34720
    Commented May 10, 2016 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .