Compare commits
No commits in common. "049a469659bde68906a4bd54afc4d7e4a4fae2eb" and "9ed6f63962728f38d59a68022609c2a4aaa5f3e8" have entirely different histories.
049a469659
...
9ed6f63962
@ -5,7 +5,6 @@ picdir=`realpath $(dirname "${BASH_SOURCE[0]}")`
|
|||||||
del="30m"
|
del="30m"
|
||||||
sud=0
|
sud=0
|
||||||
lockfile=/tmp/updateWallpaper.lock
|
lockfile=/tmp/updateWallpaper.lock
|
||||||
kill_running=0
|
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
@ -21,16 +20,12 @@ case $i in
|
|||||||
tags="${i#*=}"
|
tags="${i#*=}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-k|--kill*)
|
|
||||||
kill_running=1
|
|
||||||
;;
|
|
||||||
-h|--help*)
|
-h|--help*)
|
||||||
echo "usage: $0 <options>"
|
echo "usage: $0 <options>"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -s --start-up-delay=del Set time between start and first image request."
|
echo " -s --start-up-delay=del Set time between start and first image request."
|
||||||
echo " -d --delay=del Set delay between image requests."
|
echo " -d --delay=del Set delay between image requests."
|
||||||
echo " -t --tags=tags The actual search string. Special fields allowed."
|
echo " -t --tags=tags The actual search string. Special fields allowed."
|
||||||
echo " -k --kill Kill a previously running instance of the script."
|
|
||||||
echo "Notes:"
|
echo "Notes:"
|
||||||
echo " All times need to be formatted for the sleep command."
|
echo " All times need to be formatted for the sleep command."
|
||||||
exit 1
|
exit 1
|
||||||
@ -42,20 +37,13 @@ esac
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -e "$lockfile" ]; then
|
if [ -e "$lockfile" ]; then
|
||||||
kill -0 $(cat $lockfile)
|
echo "Error: Lock file $lockfile exists!"
|
||||||
if [ $? -eq 0 ]; then
|
echo " This most likely means another instance of the script is already running."
|
||||||
if [ $kill_running -eq 0 ]; then
|
echo " Kill it and potentially delete the lock file after that using:"
|
||||||
echo "Error: Lock file $lockfile exists!"
|
echo " rm $lockfile"
|
||||||
echo " This most likely means another instance of the script is already running."
|
exit 2;
|
||||||
echo " Use -k to kill the running process."
|
|
||||||
exit 2;
|
|
||||||
else
|
|
||||||
echo "Warning: Killing old process..."
|
|
||||||
kill $(cat $lockfile)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
echo $$ > "$lockfile"
|
touch "$lockfile"
|
||||||
|
|
||||||
if [ "$sud" != "0" ]; then
|
if [ "$sud" != "0" ]; then
|
||||||
sleep "$sud";
|
sleep "$sud";
|
||||||
@ -70,7 +58,6 @@ while [ 0 ]; do
|
|||||||
url=`echo $json | jq -r '.[0].file_url'`
|
url=`echo $json | jq -r '.[0].file_url'`
|
||||||
ext=`echo $url | sed "s/.*\.//g"`
|
ext=`echo $url | sed "s/.*\.//g"`
|
||||||
|
|
||||||
url="http:$url"
|
|
||||||
local_url="$picdir/$id.$ext"
|
local_url="$picdir/$id.$ext"
|
||||||
|
|
||||||
echo "Updating wallpaper to $id..."
|
echo "Updating wallpaper to $id..."
|
||||||
|
Loading…
Reference in New Issue
Block a user