Skip to content
  • Apollon Oikonomopoulos's avatar
    daemon-util: use systemctl if applicable · 61f8b1f7
    Apollon Oikonomopoulos authored
    
    
    daemon-util is used throughout the code for starting a daemon whenever
    this is needed (e.g. during cluster bootstrapping or master failover).
    
    In order not to confuse systemd and its service supervision code,
    daemon-util needs to cooperate with it. Thus, we use systemctl for all
    operations if both of these conditions hold:
    
     - systemd is running as PID 1, checked via the existence of
       /run/systemd/system, as per sd_booted(3).
     - systemd has the ganeti.target unit loaded, indicating that the
       relevant systemd unit files have been installed.
    
    Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
    Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
    61f8b1f7