Skip to content

Commit

Permalink
11
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoobPG authored and MrDoobPG committed Aug 23, 2019
1 parent 5483149 commit e856d79
Show file tree
Hide file tree
Showing 12 changed files with 946 additions and 0 deletions.
46 changes: 46 additions & 0 deletions menu/pgui/templates/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
#
# Title: PTS Community
# Author: MrDoob
# URL: WTFH >-!-< why you need this ^^
# GNU: General Public License v3.0
#
################################################################################
mkdir -p /var/plexguide/checkers
rm -rf /var/plexguide/checkers/*.log
#mkdir -p /var/plexguide/checkers

mgversion="$(curl -s https://api.github.com/repos/trapexit/mergerfs/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
touch /var/plexguide/checkers/mgfs.log
touch /var/plexguide/checkers/mergerfs.log

mergfs="$(mergerfs -v | grep 'mergerfs version:' | awk '{print $3}')"
echo "$mergfs" >> /var/plexguide/checkers/mgfs.log

mgstored="$(tail -n 1 /var/plexguide/checkers/mgfs.log)"

if [[ "$mgversion" == "$mgstored" ]];then
echo " ✅ No update needed !" >/var/plexguide/checkers/mergerfs.log
elif [[ "$mgversion" != "$mgstored" ]]; then
echo " ⛔ Update possible !" >/var/plexguide/checkers/mergerfs.log
else echo "stupid line"

fi



rcversion="$(curl -s https://api.github.com/repos/rclone/rclone/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')"
touch /var/plexguide/checkers/rclonestored.log
touch /var/plexguide/checkers/rclone.log
rcstored="$(rclone --version | awk '{print $2}' | tail -n 3 | head -n 1 )"
echo "$rcstored" >> /var/plexguide/checkers/rclonestored.log

rcstored="$(tail -n 1 /var/plexguide/checkers/rclonestored.log)"

if [[ "$rcversion" == "$rcstored" ]]; then
echo " ✅ No update needed !" >/var/plexguide/checkers/rclone.log
elif [[ "rcversion" != "rcstored" ]]; then
echo " ⛔ Update possible !" >/var/plexguide/checkers/rclone.log
else echo "stupid line"

fi
21 changes: 21 additions & 0 deletions menu/pgui/templates/dynamic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- name: Update APT package cache
apt: update_cache=yes cache_valid_time=600

- name: Upgrade APT to the latest packages
apt: upgrade=dist
register: apt_result

- name: Install a list of packages
command: apt-get install -y jq dnsutils ctop
register: apt_result
changed_when: "'packages will be installed' in apt_result.stdout"

- name: Autoremove unused packages
command: apt-get -y autoremove
register: apt_result
changed_when: "'packages will be REMOVED' in apt_result.stdout"

- name: Purge residual kernel packages
shell: apt-get remove -y --purge $(dpkg -l | grep "^rc\s*linux-image-" | awk '{print $2}' | tr '\n' ' ')
register: apt_result
changed_when: "'packages will be REMOVED' in apt_result.stdout"
64 changes: 64 additions & 0 deletions menu/pgui/templates/gtused.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
#
# Title: PGBlitz (G/TDrive used space)
# Author(s): Admin9705
# Coder: MrDoob
# URL: https://pgblitz.com - http://github.pgblitz.com
# GNU: General Public License v3.0
################################################################################
#functions
config="/opt/appdata/plexguide/rclone.conf"
log="/var/plexguide"
useragent="$(cat /var/plexguide/uagent)"

#if else loop for checking what is running

if grep -q "gdrive:" $config; then
rclone size gdrive: \
--verbose=1 \
--fast-list \
--retries 3 \
--no-update-modtime \
--user-agent="$useragent" \
--timeout=30m \
--exclude="**encrypt**" \
--config /opt/appdata/plexguide/rclone.conf | awk '{print $3,$4}' >>$log/gduncrypt.log
sed -i 's/Total size: / /g' $log/gduncrypt.log
fi
sleep 2
if grep -q "tdrive:" $config; then
rclone size tdrive: \
--verbose=1 \
--fast-list \
--retries 3 \
--no-update-modtime \
--user-agent="$useragent" \
--timeout=30m \
--exclude="**encrypt**" \
--config /opt/appdata/plexguide/rclone.conf | awk '{print $3,$4}' >>$log/tduncrypt.log
sed -i 's/Total size: / /g' $log/tduncrypt.log
fi
sleep 2
if grep -q "gcrypt:" $config; then
rclone size gcrypt: \
--verbose=1 \
--fast-list \
--retries 3 \
--user-agent="$useragent" \
--no-update-modtime \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf | awk '{print $3,$4}' >>$log/gdcrypt.log
sed -i 's/Total size: / /g' $log/gdcrypt.log
fi
sleep 2
if grep -q "tcrypt:" $config; then
rclone size tcrypt: \
--verbose=1 \
--fast-list \
--retries 3 \
--user-agent="$useragent" \
--no-update-modtime \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf | awk '{print $3,$4}' >>$log/tdcrypt.log
sed -i 's/Total size: / /g' $log/tdcrypt.log
fi
27 changes: 27 additions & 0 deletions menu/pgui/templates/gtused.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
# Title: PTS Community
# Author: MrDoob
# URL: WTFH >-!-< why you need this ^^
# GNU: General Public License v3.0
#
################################################################################
---
- cron:
name: Daily G/TDrive used space check | file checker
special_time: 'daily'
job: 'bash /opt/appdata/pgui/gtused.sh'
state: absent
ignore_errors: yes

- cron:
name: Daily check for mgerfs / rclone new version
special_time: 'daily'
job: 'bash /opt/appdata/pgui/ckeck.sh'
state: present

- cron:
name: Daily G/TDrive used space checker | file & folder
special_time: 'daily'
job: 'bash /opt/appdata/pgui/gtused.sh'
state: present
Loading

0 comments on commit e856d79

Please sign in to comment.