On Do, 25.07.19 19:16, Debraj Manna (subharaj.ma...@gmail.com) wrote: > Thanks Mantas for replying. > > ExecStartPre=-/bin/su ubuntu -c "/home/ubuntu/build-target/ > kafka/kafka-systemd-prestart.sh" > ExecStart=/bin/su ubuntu -c "/home/ubuntu/build-target/ > kafka/kafka-systemd-health.sh" > ExecStopPost=-/bin/bash /home/ubuntu/build-target/ > kafka/kafka-systemd-poststop.sh > > If I specify User= then all the scripts will be executed with that user. > Can you let me know if I only need to execute > kafka-systemd-prestart.sh and kafka-systemd-health.sh > with let's say ubuntu user and kafka-systemd-poststop.sh with root user > what is the recommended way to do this?
Use "ExecStartPre=+…" for running some ExecXYZ= lines with full privileges. See documentation for details. You may combine "+" and "-" if you like. Lennart -- Lennart Poettering, Berlin _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel