Rolle: bdfr entfernt (#236)
Co-authored-by: Michael Grote <michael.grote@posteo.de> Reviewed-on: mg/ansible#236 Co-authored-by: mg <michael.grote@posteo.de> Co-committed-by: mg <michael.grote@posteo.de>
This commit is contained in:
parent
9bfdd871e9
commit
d5ecd4f2d1
5 changed files with 0 additions and 116 deletions
|
@ -1,23 +0,0 @@
|
|||
## mgrote.bdfr
|
||||
|
||||
Installiert [Bulk Downloader for Reddit](https://github.com/aliparlakci/bulk-downloader-for-reddit#configuration).
|
||||
Erstellt einen Cronjob.
|
||||
|
||||
__Benötigt einen Webbrowser!__
|
||||
|
||||
### getestet auf
|
||||
- [ Linux Mint (>20.1)
|
||||
|
||||
|
||||
### Variablen + Defaults
|
||||
see [defaults](./defaults/main.yml)
|
||||
|
||||
|
||||
## Script einrichten(Token von Reddit holen)
|
||||
1. Script ausführen `bdfr_download.sh`
|
||||
2. Link anklicken
|
||||
3. bei Reddit anmelden
|
||||
4. Download...
|
||||
|
||||
## to HTML
|
||||
* https://github.com/BlipRanger/bdfr-html
|
|
@ -1,4 +0,0 @@
|
|||
---
|
||||
bdfr_data_path: /mnt/bdfr/reddit
|
||||
bdfr_data_mount: /mnt/bdfr
|
||||
bdfr_log_file: /var/log/bdfr.log
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
- name: install python3.9
|
||||
become: yes
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- python3.9
|
||||
- python3-pip
|
||||
state: present
|
||||
|
||||
- name: Install bdfr
|
||||
become: yes
|
||||
shell: python3.9 -m pip install bdfr --upgrade
|
||||
changed_when: False
|
||||
|
||||
- name: copy bdfr_download.sh
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: "bdfr_download.sh"
|
||||
dest: "/usr/local/bin/bdfr_download.sh"
|
||||
mode: 0755
|
||||
owner: mg
|
||||
group: mg
|
||||
|
||||
- name: create cronjob
|
||||
become: true
|
||||
ansible.builtin.cron:
|
||||
name: bdfr
|
||||
minute: "41"
|
||||
hour: "2"
|
||||
job: "/usr/local/bin/bdfr_download.sh >> {{ bdfr_log_file }}"
|
||||
state: present
|
||||
|
||||
- name: copy logrotate config
|
||||
become: yes
|
||||
ansible.builtin.template:
|
||||
src: logrotate_config
|
||||
dest: /etc/logrotate.d/bdfr
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
{{ file_header | default () }}
|
||||
|
||||
chmod +x /home/mg/.config/bdfr/default_config.cfg
|
||||
|
||||
# These functions return exit codes: 0 = found, 1 = not found
|
||||
# https://serverfault.com/questions/50585/whats-the-best-way-to-check-if-a-volume-is-mounted-in-a-bash-script
|
||||
isMounted () { findmnt -rno SOURCE,TARGET "$1" >/dev/null;} #path or device
|
||||
|
||||
#!/bin/bash
|
||||
{{ file_header | default () }}
|
||||
LOCKDIR=${HOME}/.cache # set lockdir
|
||||
function exlock() { # define Function for setting lock; stops the script i a lock exists
|
||||
exec {lock_fd}>${LOCKDIR}/$(basename $0).lock
|
||||
flock -nx "$lock_fd"
|
||||
if [[ $? == 1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
function unlock() { # define function for removing lock
|
||||
rm "${LOCKDIR}/$(basename $0).lock"
|
||||
[[ -n $1 ]] && exit $1
|
||||
exit
|
||||
}
|
||||
|
||||
exlock # set lock
|
||||
if isMounted "{{ bdfr_data_mount }}";
|
||||
then
|
||||
python3.9 -m bdfr clone {{ bdfr_data_path }} --no-dupes --search-existing --submitted --upvoted --saved --authenticate --user me
|
||||
python3.9 -m bdfr clone {{ bdfr_data_path }} --no-dupes --search-existing --subreddit SCPDeclassified
|
||||
else echo "share is not mounted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unlock # entferne lock
|
|
@ -1,14 +0,0 @@
|
|||
{{ file_header | default () }}
|
||||
{{ bdfr_log_file }} {
|
||||
missingok
|
||||
nocreate
|
||||
rotate 4
|
||||
weekly
|
||||
compress
|
||||
missingok
|
||||
notifempty
|
||||
dateext
|
||||
dateyesterday
|
||||
sharedscripts
|
||||
endscript
|
||||
}
|
Loading…
Reference in a new issue