<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi,</div>
<div> </div>
<div>back in the rcX days I configured a backup system which blocks a system shutdown in a certain state (network and mounts still active) if a backup is still running. The init script looks like this:</div>
<div> </div>
<div>...</div>
<div>
<div>case "$1" in</div>
<div>...</div>
<div>
<div> stop) <br/>
plymouth --ping<br/>
if [ $? -ne 0 ]; then<br/>
log_daemon_msg "waiting for running backup" "backup"<br/>
else<br/>
plymouth message --text="waiting for running backup"<br/>
fi<br/>
sleep 10<br/>
logger -t backup "rcS: trying to get lock..."<br/>
exec {FD}<>"$LOCKFILE"<br/>
{<br/>
logger -t backup "locked rsync_wrapper: waiting for lock"<br/>
flock ${FD}<br/>
}<br/>
logger -t backup "rcS: continue shutdown..."<br/>
plymouth message --text=""</div>
<div> </div>
<div>...<br/>
esac</div>
<div>...</div>
</div>
<div> </div>
<div>The strategy is to wait for a successful lock on a shared LOCKFILE.</div>
<div> </div>
<div>Now, I want to solve this with systemd. I've read tons of documentation but I don't get it, all my experiments failed. I am using Linux Mint 21 "Vanessa", which is based on Ubunut 22.04.</div>
<div> </div>
<div>I am looking for a solution which</div>
<div> </div>
<div>* "pauses" a shutdown or reboot attempt as long as the LOCK cannot be obtained (which means the backup is still running)</div>
<div>* while the network connection (ethernet) is still active</div>
<div>* and all mounts (local, usb and cifs) are still active</div>
<div>* openssh-server still running</div>
<div>* The logging functionality (plymouth / log_daemon) would be nice. so the system should be allowed to shutdown to a stage where plymouth is already visible</div>
<div> </div>
<div>Can you please help me?</div>
<div> </div>
<div>Best regards</div>
<div>Henning</div>
</div></div></body></html>