Added a lockfile
This commit is contained in:
parent
0e7c9f71e2
commit
9ed6f63962
@ -4,6 +4,7 @@ tags="scenic order:random width:1600"
|
|||||||
picdir=`realpath $(dirname "${BASH_SOURCE[0]}")`
|
picdir=`realpath $(dirname "${BASH_SOURCE[0]}")`
|
||||||
del="30m"
|
del="30m"
|
||||||
sud=0
|
sud=0
|
||||||
|
lockfile=/tmp/updateWallpaper.lock
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
@ -35,6 +36,15 @@ case $i in
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -e "$lockfile" ]; then
|
||||||
|
echo "Error: Lock file $lockfile exists!"
|
||||||
|
echo " This most likely means another instance of the script is already running."
|
||||||
|
echo " Kill it and potentially delete the lock file after that using:"
|
||||||
|
echo " rm $lockfile"
|
||||||
|
exit 2;
|
||||||
|
fi
|
||||||
|
touch "$lockfile"
|
||||||
|
|
||||||
if [ "$sud" != "0" ]; then
|
if [ "$sud" != "0" ]; then
|
||||||
sleep "$sud";
|
sleep "$sud";
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user