I would create upstart script, which will flushing dirty pages from DB before shutdown. I use Ubuntu 14.04 and MariaDB. I start upstart script with this:
start on stopping mysql
script
[something]
end script
but script returns:
start: Unknown job: on
Script started, file is typescript
But script does nothing... Where I have mistake? Can anybody help me, please? Ths ;)