PDA

View Full Version : How to by pass systmed with init.d scripts



cisaksen
15-Sep-2015, 15:11
Is there a way to stop/prevent the system from redirecting an init.d script to systemctl ?

I have seen 2 possibilities for other distros but neither seem to work for SLES 12.

SYSTEMD_NO_WRAP=1
_SYSTEMCTL_SKIP_REDIRECT=true

Is there one specific for SLES 12 ?

jmozdzen
15-Sep-2015, 15:40
Hi cisaksen,

Is there a way to stop/prevent the system from redirecting an init.d script to systemctl ?

I have seen 2 possibilities for other distros but neither seem to work for SLES 12.

SYSTEMD_NO_WRAP=1
_SYSTEMCTL_SKIP_REDIRECT=true

Is there one specific for SLES 12 ?

Using SYSTEMD_NO_WRAP should work for proper rc files. From /etc/rc.status:

# Check if the service is used under systemd but not started with
if test -z "$SYSTEMD_NO_WRAP" && /usr/bin/mountpoint -q /sys/fs/cgroup/systemd; then
...

Regards,
Jens

cisaksen
15-Sep-2015, 16:02
When I run service mysql bootstrap I get the results from case "$1" in from rc.status code

Background: I'm trying to setup a Galera MariaDB Cluster.

I'm getting the init.d script to work when I run it this way: /etc/init.d/mysql bootstrap bootstrap is a option in the init.d script.

malcolmlewis
15-Sep-2015, 16:09
On Tue 15 Sep 2015 03:04:01 PM CDT, cisaksen wrote:


When I run *service mysql bootstrap* I get the results from -case "$1"
in- from rc.status code

Background: I'm trying to setup a Galera MariaDB Cluster.

I'm getting the init.d script to work when I run it this way:
/etc/init.d/mysql bootstrap bootstrap is a option in the init.d
script.




Hi
Just write a simple systemd service file and pop
it into /etc/systemd/system calling the init script with start and stop
lines....?

--
Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel
3.12.44-52.10-default If you find this post helpful and are logged into
the web interface, please show your appreciation and click on the star
below... Thanks!

jmozdzen
15-Sep-2015, 16:21
Hi cisaksen,

When I run service mysql bootstrap I get the results from case "$1" in from rc.status code

Background: I'm trying to setup a Galera MariaDB Cluster.

I'm getting the init.d script to work when I run it this way: /etc/init.d/mysql bootstrap bootstrap is a option in the init.d script.

if I understand you correctly, you're saying that calling "service mysql bootstrap" does forward to systemd, but the parameter "bootstrap" isn't forwarded to the actual script? That'd be conforming to the man page:
[QUOTE]service SERVICE ACTION [OPTIONS]
[...]
The SERVICE parameter specifies a systemd service name to operate on. The supported values of ACTION depend on the specified service. The actions start, stop, reload, restart, try-restart, force-reload, and status are
forwarded to systemctl, OPTIONS are ignored in that case. Other actions may be defined in /usr/lib/initscripts/legacy-actions. Legacy actions are called directly and OPTIONS are passed on the command line.(QUOTE]

I guess you have not created /usr/lib/initscripts/legacy-actions/mysql/bootstrap as a script to invoke /etc/init.d/mysql bootstrap after setting SYSTEMD_NO_WRAP ;)

Regards,
Jens

Regards,
Jens

cisaksen
15-Sep-2015, 16:35
Yea didn't know about the /usr/lib/initscripts/legacy-actions/ so no nothing there. So I would create the mysql folder and add a bootstrap script underneath. That script executes the appropriate commands based on what's in the original init.d script. ? Or is it easier than that ? Simply copy the init.d script to /usr/lib/initscripts/legacy-actions/mysql and rename it bootstrap ?

Thanks you your help.

jmozdzen
15-Sep-2015, 16:43
Hi cisaksen,

Yea didn't know about the /usr/lib/initscripts/legacy-actions/

RTFM ;)


Simply copy the init.d script to /usr/lib/initscripts/legacy-actions/mysql and rename it bootstrap ?

That most likely won't work - as the script will be called without the parameter (AFAIK). So as I wrote: Call "/etc/init.d/mysqld bootstrap", and perhaps circumvent having that script call systemd again. Although the later should not really be necessary, since the redirect code will not catch on the "bootstrap" operation.

There should be a sample implementation for ntp (unless you have not ntpd installed) in those directories.

Regards,
Jens