Re: [systemd-devel] Redirect logs from script to systemd's StandardOutput file
On Do, 12.03.20 14:40, Ani A (aniruddh...@gmail.com) wrote: > Hello, > > I am on Ubuntu 18.04.2, and I have systemd version 237. I have some common > tasks > which need to happen prestart and poststop which I have moved to a > script. All unit > files look like: > > StandardOutput=file:/var/log/my-.log > ExecStartPre=/path/to/helper.sh -t prestart -u > ExecStopPost=/path/to/helper.sh -t poststop -u > ExecStart=/path/to/my/exe > > where is the name of the systemd unit file. > > I use systemd's directive to log stdout to file, and in the prestart > and poststop actions also > I try to write some logs to the same file with shell echo, like: > > echo "..." >> /var/log/my-.log > > The logs that is written by the script does not appear in the log file! > Is there anything wrong here (missing something) ? Please provide the full unit file. Lennart -- Lennart Poettering, Berlin ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Redirect logs from script to systemd's StandardOutput file
Hi Andrei, > > echo "..." >> /var/log/my-.log > > > > It is not clear where you are using this command. In one of scripts that > are part of unit definition? In some other script that is run outside of > running unit? In interactive shell session? This command is called from the shell script which is invoked with ExecStartPre and ExecStartPost. -- Ani ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Redirect logs from script to systemd's StandardOutput file
12.03.2020 12:10, Ani A пишет: > Hello, > > I am on Ubuntu 18.04.2, and I have systemd version 237. I have some common > tasks > which need to happen prestart and poststop which I have moved to a > script. All unit > files look like: > > StandardOutput=file:/var/log/my-.log > ExecStartPre=/path/to/helper.sh -t prestart -u > ExecStopPost=/path/to/helper.sh -t poststop -u > ExecStart=/path/to/my/exe > > where is the name of the systemd unit file. > > I use systemd's directive to log stdout to file, and in the prestart > and poststop actions also > I try to write some logs to the same file with shell echo, like: > > echo "..." >> /var/log/my-.log > It is not clear where you are using this command. In one of scripts that are part of unit definition? In some other script that is run outside of running unit? In interactive shell session? > The logs that is written by the script does not appear in the log file! > Is there anything wrong here (missing something) ? > > -- > Ani > ___ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/systemd-devel > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel