Ensure that only one autorotate instance runs at the time

This commit is contained in:
Fabio Manganiello 2022-01-31 01:46:35 +01:00
parent d92d98a4b8
commit f341472c17
1 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,12 @@
#!/bin/bash
pidfile=/tmp/autorotate.pid
if ps -p $(cat "$pidfile" 2>/dev/null) >/dev/null; then
echo "An autorotate process is already running - if not please remove $pidfile" >&2
exit 1
fi
echo $$ > "$pidfile"
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "$script_dir/cutiepi-screen-common"