systemd - spawning other processes

Discussion in 'Other Operating Systems' started by Primüs, Jun 14, 2017.

  1. Primüs

    Primüs Member

    Joined:
    Apr 1, 2003
    Messages:
    3,321
    Location:
    CFS
    Hi Guys,

    Writing a systemd startup script. Its basically to do some special checks before starting mysql (with certain flags based on the check).

    This is all on ubuntu 16.04

    Ultimately its just a bash script that checks a few conditions and then either calls

    /etc/init.d/mysql start --some-args

    or

    /etc/init.d/mysql start --other-args


    The script works fine being invoked by root on CLI.

    Once pushing it to a systemd mysql-check.service, it still seems to run OK, but systemd is starting the mysql process and then appears to kill it when the script ends (ending 0/SUCCESS), how do I spawn those processes from the systemd script so they continue to run outside of the initial bash script when run inside systemd?

    thanks in advance
     
  2. OP
    OP
    Primüs

    Primüs Member

    Joined:
    Apr 1, 2003
    Messages:
    3,321
    Location:
    CFS
    bah.

    Literally 2 minutes after I post, i find my answer.

    Setting KillMode=process under [Service] allows all spawned processes to keep running after the parent ends.

    It's not a perfect solution but it works :) I'll adapt it over time.
     

Share This Page