Problem adding new startup/boot script

Hi

I am having problems adding a new startup script. In the past I just copied a working script like /etc/init.d/squid to /etc/init.d/mysquid, modified the INIT INFO section plus what ever I required to be different and run insserv /etc/init.d/mysquid.

Now if I do that and run /etc/init.d/mysquid start I get

redirecting to systemctl start mysquid
Failed to issue method call: Unit mysquid failed to load: No such file or directory. See system logs and ‘systemctl status mysquid’ for details.

systemctl status mysquid
mysquid
Loaded: error (Reason: No such file or directory)
Active: inactive (dead)

What is now a days the right process to clone an /etc/init.d file ?

I use:

uname -a

Linux opensuse12.suse.home 3.7.10-1.40-desktop #1 SMP PREEMPT Thu Jul 10 11:22:12 UTC 2014 (9b06319) x86_64 x86_64 x86_64 GNU/Linux

cat /etc/SuSE-release

openSUSE 12.3 (x86_64)
VERSION = 12.3
CODENAME = Dartmouth

Thank you
Markus

Did you change the “Provides: xxx” line in the INIT INFO header?

Try to run “sudo systemctl daemon-reload” (or reboot) to make systemd aware of the change.

I did update Provides and run systemctl daemon-reload

I searched for any squid related systemsd file and found /usr/lib/systemd/system/squid.service .
I copied it to /usr/lib/systemd/system/mysquid.service with the required updates, run systemctl daemon-reload without any change

Thank you
Markus

Well, this would “shadow” /etc/init.d/squid, but not your self-created mysquid.

I copied it to /usr/lib/systemd/system/mysquid.service with the required updates, run systemctl daemon-reload without any change

Did you try to run insserv again?
I don’t think this will work with systemd service files.
Try “systemctl enable mysquid.service” instead.

PS: If your goal is just to modify the existing squid service file, copy it to /etc/systemd/system and modify that. No need for creating a differently named copy.

I was looking to run a second squid server on a different port with a different configuration file. enable gave me:

systemctl enable mysquid.service

ln -s ‘/usr/lib/systemd/system/mysquid.service’ ‘/etc/systemd/system/multi-user.target.wants/mysquid.service’

now the start command just hangs.

Is there anywhere a possibility to get more verbose output for troubleshooting system ?

Thank you
Markus

The only way to get this to work for e is disabling system with

export SYSTEMD_NO_WRAP=1

Markus

I don’t know anything about squid, but maybe this would be possible with one running instance?

For having two instances running in parallel, you’d at least need to change the line “PIDFile=/run/squid.pid” I’d say. And of course change the Exec… lines to use a different config file.
Did you do this?

now the start command just hangs.
Which start command?
“systemctl enable” only enables automatic start at boot.
For actually starting it now, you have to run “systemctl start mysquid.service”.

And what exactly do you mean with “hang”?
Maybe post your .service file.

[QUOTE]Is there anywhere a possibility to get more verbose output for troubleshooting system ?

journalctl.
Or run “systemctl status mysquid.service”, this should show the relevant lines from the journal as well.

Not really as I want it to.

Yes I did manually update the services file. BTW is that the only way to create the services file ? I looked at the squid rpm postinstall and could not see it creating the services file nor have it as part of the package.

Apologies I meant /etc/init.d/mysquid start

++ echo ‘redirecting to systemctl start mysquid’
redirecting to systemctl start mysquid
++ test -n mysquid -a -x /bin/systemctl
++ exec /bin/systemctl start mysquid
Job for mysquid timed out.

systemctl status mysquid
mysquid
Loaded: loaded
Active: inactive (dead)

Does it start without redirection to systemd?

SYSTEMD_NO_WRAP=1 /etc/init.d/mysquid start

Yes it works when bypassing systemd. I really now trying to understand how systemd is suppose to work and how rpm packages like squid make the startup with systemd work.

Markus

Looking at squid package, squid.service does not use /etc/init.d/squid at all, which means this script may not be tested with systemd. So I suggest to forget it. Now please show your mysquid.service. It is impossible to make any comment on service without seeing actual service definition.

Not sure why you say that.

rpm -q -f /etc/init.d/squid

squid-3.2.11-3.16.1.x86_64

I also see that the servives file is part of the package.

rpm -q -f /usr/lib/systemd/system/squid.service

squid-3.2.11-3.16.1.x86_64

I’ll check the pre/post install scripts. Maybe it tells me any commands used to activate.

Markus