docker-chromium/rootfs/etc/services.d/app/kill

25 lines
534 B
Bash
Executable file

#!/bin/sh
#
# Chromium doesn't gracefully shutdown when receiving SIGTERM. For example, last
# opened tabs may not be saved. Instead, terminate Chromium by sending the
# CTRL+q key presses.
#
set -e # Exit immediately if a command exits with a non-zero status.
set -u # Treat unset variables as an error.
xdotool key "Escape"
sleep 0.5
xdotool key "ctrl+q"
for i in $(seq 1 10)
do
if ! ps | grep "/usr/lib/chromium/chromium" | grep -q -v grep
then
break
fi
sleep 0.5
done
# vim:ft=sh:ts=4:sw=4:et:sts=4