BBB, Mysql, systemd and halt/reboot

Using Wheezy on the BBB (2015.03 console image). The mysql package is in the in-between state of apparently using both mysqld-safe and systemd.
If I run “service mysql stop”, the systemd mysql service stops seemingly happily and in /var/log/syslog I see the shutdown of mysql logged from mysqld.
However, if I issue a system “halt” or “reboot” or even a systemctl poweroff, I see no evidence of a clean mysql shutdown in the syslog.

I’m unsure if mysql is being halted cleanly upon system halt/reboot and just not logged, or if the process is just being killed (leading to the possibility of data corruption).
Cheers for any pointers / debugging ideas.
Jon Ross

Using Wheezy on the BBB (2015.03 console image). The mysql package is in the in-between state of apparently using both mysqld-safe and systemd.

Wheezy is technically not a systemd debian. It was added by Robert, and in fact it can be disabled. IF that is what you want.

So my limited understanding of systemd is that you create services files, with targets, rules, etc. What it seems you need to do is write a service script that must be run before any of those system power options are engaged. As to how, I’m not exactly sure, but pretty sure a google session would be fruitful.

Thanks William. What’s confusing is that the mysql service shuts down from systemd on “service mysql stop”. But on system reboot the systemd units are all supposed to halt, and this does not appear to be happening for mysql.
For the hell of it, I installed the 2016-02-21 jessie image, added mysql and did the same test - same result. There is a log entry of mysql shutting down from manual service mysql stop. No log when issuing a halt or reboot to the system.
Feb 24 23:21:05 beaglebone mysql[1106]: Stopping MySQL database server: mysqld.
I am guessing the version of mysql package that installs on the BB (5.5.47) is not playing nicely with systemd (it seems to be a fake systemd unit that actually uses init.d)

I made a successful workaround of creating my own service that runs a script upon exit. This script then runs /etc/init.d/mysql stop.
JR

You know what. Maybe just toss together a custom script to deal with it for you ? Such as sql shutdown, then reboot, halt ?