LaunchD and Bing Wallpaper Shell Script -
LaunchD and Bing Wallpaper Shell Script -
i'm trying utilize bing wallpaper downloader mac & ubuntu (found here: https://github.com/thejandroman/bing-wallpaper) download daily bing wallpaper , set background. script runs fine if run myself terminal typing:
sh /users/noahschneider/pictures/wallpaper-changer/bing-wallpaper.sh
however, when seek set launchd tasks, not work. launchd plist file stored in /users/noahschneider/library/launchagents/ , looks this:
<?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple computer//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>label</key> <string>com.ideasftw.bing-wallpaper</string> <key>programarguments</key> <array> <string>/bin/bash</string> <string>/users/noahschneider/pictures/wallpaper-changer/bing-wallpaper.sh</string> </array> <key>lowpriorityio</key> <true/> <key>nice</key> <integer>1</integer> <key>startcalendarinterval</key> <dict> <key>hour</key> <integer>8</integer> <key>minute</key> <integer>30</integer> </dict> </dict> </plist>
this calls bing-wallpaper.sh downloads bing wallpaper of day folder , looks this:
#!/usr/bin/env bash picture_dir="$home/pictures/bing-wallpapers/" rm -rf /users/noahlschneider/pictures/bing-wallpapers mkdir -p $picture_dir onlyone=0 while ! ping -w 1 -c 1 8.8.8.8 >&/dev/null; sleep 10; done urls=( $(curl -s http://www.bing.com | \ grep -eo "url:'.*?'" | \ sed -e "s/url:'\([^']*\)'.*/http:\/\/bing.com\1/" | \ sed -e "s/\\\//g") ) p in ${urls[@]}; filename=$(echo $p|sed -e "s/.*\/\(.*\)/\1/") if [ ! -f $picture_dir/$filename ] && [ $onlyone -eq 0 ]; echo "downloading: $filename ..." curl -lo "$picture_dir/$filename" $p onlyone=$((onlyone+1)) else echo "skipping: $filename ..." fi osascript /users/noahschneider/pictures/wallpaper-changer/next-wallpaper.scpt done
this script in turn calls apple script changes wallpaper looks this:
tell application "system events" set rotinterval alter interval of current desktop set alter interval of current desktop 1 delay 1 set alter interval of current desktop rotinterval end tell
whats going wrong? script not have administrator privilege needed when run in way? give thanks you!
shell launchd
Comments
Post a Comment