Last active
July 27, 2017 09:25
-
-
Save emersion/c2faba1f2aba5ba7509b4c74fcb95e71 to your computer and use it in GitHub Desktop.
background-rotate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/bash | |
| set -euf -o pipefail | |
| tag=$(cat ~/.background-tags | tr '\n' ' ') | |
| url=$(curl 'https://yande.re/post.json' -G --data-urlencode "tags=$tag order:random limit:1" | jq -r '.[0].file_url') | |
| curl -o ~/.background "$url" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Rotate background image | |
| After=network-online.target | |
| Wants=network-online.target | |
| [Service] | |
| Type=oneshot | |
| ExecStart=%h/bin/background-rotate | |
| Restart=on-failure | |
| RestartSec=30 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Unit] | |
| Description=Rotate background image | |
| [Timer] | |
| OnCalendar=daily | |
| Persistent=true | |
| [Install] | |
| WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment