Score:0

Why does a systemd script stop writing to a log after restarting the service?

jp flag

I have a systemd unit file. It starts a php script. There was a network blip, which made me have to reboot after nothing else worked. I noticed that the script was no longer writing to the specified log file, until I manually forced rotation.

[Unit]
Description=Custom Service
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/php -f /path/to/php/script.php
ExecStopPost=/bin/bash /usr/local/bin/script-stopped.sh <--- Just sends an email
StandardOutput=file:/var/log/script.log <---Stops writing after restart unless I rotate

[Install]
WantedBy=multi-user.target

I'm trying to understand why this occurs on a verbose technical level. After trying to search for information, I feel like I'm not searching for the right thing, so I thought an explanation would help.

Edit Perhaps this is related? https://serverfault.com/a/718947/409772

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.