{"id":632,"date":"2018-02-15T22:54:47","date_gmt":"2018-02-15T22:54:47","guid":{"rendered":"https:\/\/www.cesariogarcia.com\/?p=632"},"modified":"2018-11-08T16:30:51","modified_gmt":"2018-11-08T16:30:51","slug":"bing-wallpaper-and-lockscreen-script","status":"publish","type":"post","link":"https:\/\/www.cesariogarcia.com\/?p=632","title":{"rendered":"Bing Wallpaper and Lockscreen script"},"content":{"rendered":"<p>Here is a simple script to update your wallpaper and your lockscreen every two hours!<br \/>\nEnjoy!<\/p>\n<pre><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n\n# Bing wallpapers\n# Ces\u00e1rio Garcia Mil-Homens\n# cesario@cesariogarcia.com\n# https:\/\/www.cesariogarcia.com\n\n# 1. Execute this script the first time and set \"bingwallpaper.jpg\" as wallpaper and lockscreen\n# 2. Config $wallpaperPath (line 13 of this script) for the full path of where you want \"bingwallpaper.jpg\" to be (it should be on the user Pictures folder)\n# 3. On the terminal execute the following script, this will check for new updates every two hours\n# crontab -l | { cat; echo \"0 *\/2 * * * \/bin\/bash \/home\/cesario\/Programs\/bingwallpapers.sh &amp;gt;\/dev\/null 2&amp;gt;&amp;amp;1\"; } | crontab -\n\nwallpaperPath=\"\/home\/cesario\/Pictures\"\n\nwget -q --spider http:\/\/google.com\n\nif &#x5B; $? -eq 0 ]; then\n    echo \"Online\"\n\timageName=$(curl -s \"https:\/\/www.bing.com\/HPImageArchive.aspx?format=xml&amp;amp;idx=0&amp;amp;n=1&amp;amp;mkt=en-US\" | grep -o -m 1 \"\/az\/hprichbg\/rb\/.*._1366x768.jpg\")\n    prefix=\"\/az\/hprichbg\/rb\/\";\n\timageName=${imageName#$prefix};\n\tsuffix=\"_1366x768.jpg\";\n\timageName=${imageName%$suffix};\n\t\tif &#x5B; -e $wallpaperPath\"\/\"$imageName\"_1366x768.jpg\" ]\n\t\tthen\n\t\t\techo \"$imageName found.\"\n\t\telse\n\t\t\techo \"$imageName not found.\"\n\t\t\twget \"https:\/\/www.bing.com\/az\/hprichbg\/rb\/\"$imageName\"_1366x768.jpg\" -P $wallpaperPath\n\t\t\tcp $wallpaperPath\"\/\"$imageName\"_1366x768.jpg\" $wallpaperPath\"\/\"bingwallpaper.jpg\n\t\tfi\nelse\n    echo \"Offline\"\nfi\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Here is a simple script to update your wallpaper and your lockscreen every two hours! Enjoy! #!\/bin\/bash # Bing wallpapers # Ces\u00e1rio Garcia Mil-Homens # cesario@cesariogarcia.com # https:\/\/www.cesariogarcia.com # 1. Execute this script the first time and set &#8220;bingwallpaper.jpg&#8221; as wallpaper and lockscreen # 2. Config $wallpaperPath (line 13 of this script) for the full &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.cesariogarcia.com\/?p=632\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Bing Wallpaper and Lockscreen script&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[9,13,14,19,21],"tags":[],"class_list":["post-632","post","type-post","status-publish","format-standard","hentry","category-fotografia","category-internet","category-linux","category-programacao","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=632"}],"version-history":[{"count":2,"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=\/wp\/v2\/posts\/632\/revisions"}],"predecessor-version":[{"id":661,"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=\/wp\/v2\/posts\/632\/revisions\/661"}],"wp:attachment":[{"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cesariogarcia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}