mirror of
https://github.com/BlackLight/cutiepi-rotation-scripts.git
synced 2024-11-27 22:05:12 +01:00
Ensure that only one autorotate instance runs at the time
This commit is contained in:
parent
d92d98a4b8
commit
f341472c17
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,12 @@
|
||||||
#!/bin/bash
|
#!/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 )"
|
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
source "$script_dir/cutiepi-screen-common"
|
source "$script_dir/cutiepi-screen-common"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue