1

I'm writing a script to backup each mysql databases separately on from a mysql server, but instead of handling this inside the script I would like to rely on systemd to generate a backup job to get all the benefits from systemd (I/O, nice, cgroups).

The script, which would be itself triggered by a systemd timer would list all databases and for each of them launch / create a systemd task for for the current day only.

Is there a command that permit to create systemd ad-hoc task ? it could be a binary but as I plan to write a python script I'm interested to know if some python library would allow this.

best

  • The systemd service (which is being called by the timer) can be anything, including a bash script. Why do you not simply call inside a bash for (db list) loop your python script with db name and date as parameter ? there is no need to create an ad-hoc systemd task for that... – Martin Feb 24 '21 at 12:15
  • the reason behind is I'd like to be able to see the backup status for each database in systemd – Baptiste Mille-Mathias Feb 24 '21 at 13:31
  • why don't you let your script write messages to the syslog (```logger``` command) ? Other option: I know that you can add a line to the output of ```systemctl status ```... Check this link about the Notify (-Access) option... https://www.freedesktop.org/software/systemd/man/systemd.service.html#NotifyAccess= – Martin Feb 24 '21 at 15:08

0 Answers0