Skip to content
Snippets Groups Projects
Commit ba04ee08 authored by Jörg Sachse's avatar Jörg Sachse
Browse files

fix: SubApp issue #68 (by @steidl, thxalot), synchronous --stop operation to prevent DB corruption

parent b6f8bfd4
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,26 @@ Type=forking
Restart=no
Environment="PERL5LIB=/usr/local/perl/"
ExecStart=/usr/bin/perl -I /usr/local/perl/ /usr/local/bin/subapp_bagit.pl --config-file {{ vault_subapp_vars.files.subapp.path }} --start
ExecStop=/usr/bin/perl -I /usr/local/perl/ /usr/local/bin/subapp_bagit.pl --config-file {{ vault_subapp_vars.files.subapp.path }} --stop
ExecStop=/usr/bin/perl -I /usr/local/perl/ /usr/local/bin/subapp_bagit.pl --config-file {{ vault_subapp_vars.files.subapp.path }} --stop \;
ExecStop=/bin/bash -c '\
PID=$(cat /run/subapp/subapp_bagit.pid); \
if [[ ! "$PID" =~ ^[0-9]+$ ]]; then \
echo "something broke, no valid PID for submission application daemon"; \
exit 1; \
fi; \
echo "sending --stop to submission application daemon" | systemd-cat -p info; \
/usr/bin/perl -I /usr/local/perl/ /usr/local/bin/subapp_bagit.pl --config-file {{ vault_subapp_vars.files.subapp.path }} --stop; \
echo " waiting for submission application daemon to finish" | systemd-cat -p info; \
while true; do \
ps -p $PID > /dev/null; \
if [[ $? != 0 ]]; then \
break; \
fi; \
echo "submission application daemon is still running, waiting another 5 seconds" | systemd-cat -p warning; \
sleep 5; \
done; \
echo "submission application daemon stopped" | systemd-cat -p info'
User={{ vault_subapp_user }}
Group={{ vault_subapp_group }}
# EXAMPLE: TimeoutSec=600
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment