systemd advice

Posted on

Hi. Total newbie with systemd. I have a rather complex database stop/start process I'd like advice on.

I have a database product that I've had 2 scripts that have worked flawlessly for many years prior to systemd now I can't get them to function properly under systemd.

rc.script_a
script_b
rc.script_a previously was installed within the /etc/rc.d structure and calls script_b as a stop or start request and it also set some other variables/arguments for script_b as it needs to. Trying to mimic the same under systemd doesn't seem to work for me.

script_b will identify all the database accounts on the system and loop over each by starting their initial service ... the complex part is it does also inspect things fairly deeply and issues database level commands to ensure that the database is brought down cleanly as well as started cleanly so that each managed database is always available to the end-user after a reboot. There are a lot more tasks as well especially if there is a HA database component involved.

I don't see how systemd alone can perform all these checks and balances for the database layer that script_b does.

My problem is, I can get a .service file to "start" all necessary database services by ExecStart=-/path/rc.script_a start but I cannot get systemd to stop anything. It never seems to execute ExecStop=-/path/rc.script_a stop and the journal reports "stopping timed out. Terminating" "stop-sigterm timed out. Killing." immediately.

I'm not at all certain I can even use systemd for this complex of work so I'm asking for advice. I can elaborate more I just wanted to not be to detailed with my initial topic here.

[Unit]
Description=Graceful database stop start
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple

Type=forking

TimeoutSec=infinity
RemainAfterExit=true
ExecStart=-/path/rc.script_a start

ExecStart=-/path/rc.script_a start dbuser1

ExecStop=-/path/rc.script_a stop

ExecStop=-/path/rc.script_a stop dbuser1

[Install]
WantedBy=multi-user.target

Responses