What's new
PGBlitz.com

Register Now! Find useful tips, Interact /w Community Members and join the part the Best Community on the Internet!

Ideas PGui G/TDrive used space

M

MrDoob

Guest
Some one ask me .

Hey i would love how to see
"How much space i have used on my G/TDrive ? Is this possible ?" @hooper


Yes it is here the Code ;)


1.) cd /opt/appdata/plexguide
2.) nano gtused.sh

Bash:
#!/bin/bash

test="/opt/appdata/plexguide/rclone.conf"
log="/var/plexguide"


if grep -q "gdrive:" $test ; then
rclone size gdrive: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/gduncrypt.log
 sed -i 's/Total size: / /g' $log/gduncrypt.log
fi

if grep -q "tdrive:" $test ; then
 rclone size tdrive: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/tduncrypt.log
 sed -i 's/Total size: / /g' $log/tduncrypt.log
fi

if grep -q "gcrypt:" $test ; then
rclone size gcrypt: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/gdcrypt.log
 sed -i 's/Total size: / /g' $log/gdcrypt.log
fi

if grep -q "tcrypt:" $test ; then
rclone size tcrypt: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/tdcrypt.log
 sed -i 's/Total size: / /g' $log/tdcrypt.log
fi
3.) Run this a crontab every Sunday night or any else

crontab -e

Bash:
0 6 * * 0 bash /opt/appdata/plexguide/gtused.sh >/dev/null 2>&1
Your cron job will be run at: (5 times displayed)
  • 2019-05-19 06:00:00 UTC
  • 2019-05-26 06:00:00 UTC
  • 2019-06-02 06:00:00 UTC
  • 2019-06-09 06:00:00 UTC
  • 2019-06-16 06:00:00 UTC
4.) chmod +x /opt/appdata/plexguide/gtused.sh

Now the basic is done..

Happy edit the PGUI ..


-----
Here an sample ;)
Code:
cat /var/plexguide/tcrypt.log

Total objects: 25837
Total size: 68.863 TBytes (75715982959844 Bytes)
 
M

MrDoob

Guest
In my case the rclone command need round 30secs to scan all the drives for used space.
And print this on my PGGui Page.

I have a lot of infos implemented on my PPGui ,

But bye the way I will create a new index file with all infos on my GitHube account.
 
M

MrDoob

Guest
If you use only. UNCRYPT.

Remove the crypt code from the past :!:

Check this file >>
Command
Bash:
cat /opt/appdata/plexguide/rclone.conf | grep "remotes" | awk '{print $3,$4,$5,$6}'
Output:
gdrive: tdrive: gcrypt: tcrypt:
 
Last edited by a moderator:

Porkie

Senior Member
Staff
My output is gdrive: tdrive: /mnt/move, so do we remove the crypt checks from the sh script so it doesn't throw errors if we are running no encrypted tdrive.
 
M

MrDoob

Guest
I build this on my case , so I use crypt and uncrypted drives.

Maybe one other user find a solution for this ,

Maybe en if else loop.


But hey it works ;)


Edit scroll down !! Solution found
 
Last edited by a moderator:

Porkie

Senior Member
Staff
Ok just deleting the the crypt stuff works for non encrypted tdrives.

Code:
#!/bin/bash
#remove old log
rm -rf /var/plexguide/tduncrypt.log
rm -rf /var/plexguide/gduncrypt.log
#create new log

rclone size tdrive: \
--verbose=1 \
--fast-list \
--retries 3 \
--no-update-modtime \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf >> /var/plexguide/tduncrypt.log

rclone size gdrive: \
--verbose=1 \
--fast-list \
--retries 3 \
--no-update-modtime \
--timeout=30m \
--config /opt/appdata/plexguide/rclone.conf >> /var/plexguide/gduncrypt.log

exit 0
cat /var/plexguide/tduncrypt.log


Total objects: 24470
Total size: 58.657 TBytes (64493672755604 Bytes)
 

captngimpy

Senior Member
Staff
Total objects: 62059
Total size: 51.917 TBytes (57083489918067 Bytes)

Nice to finally have a number
 
M

MrDoob

Guest
Here now the real holy s*hit solution ;)

Bash:
#!/bin/bash

test="/opt/appdata/plexguide/rclone.conf"

if grep -q "gdrive:" $test  ; then 
rclone size gdrive: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> /var/plexguide/gduncrypt.log
fi

if grep -q  "tdrive:" $test ; then 
 rclone size tdrive: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> /var/plexguide/tduncrypt.log
fi

if  grep -q "gcrypt:"  $test ; then 
rclone size gcrypt: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> /var/plexguide/gdcrypt.log
fi

if grep -q "tcrypt:"  $test ; then 
rclone size tcrypt: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> /var/plexguide/tdcrypt.log
fi
I remove the rm command ,

On my command in the PGGUI I use

shell_exec = tail -n 1 /plexguide/tdrive.log

( that's only print the last line without the file line )

@Admin9705

Here the outlines for pr00f ;) its works perfect now

Bash:
bash -x test.sh
+ test=/opt/appdata/plexguide/rclone.conf
+ grep -q gdrive: /opt/appdata/plexguide/rclone.conf
+ rclone size gdrive: --verbose=1 --fast-list --retries 3 --no-update-modtime --timeout=30m --config /opt/appdata/plexguide/rclone.conf
+ grep -q tdrive: /opt/appdata/plexguide/rclone.conf
+ rclone size tdrive: --verbose=1 --fast-list --retries 3 --no-update-modtime --timeout=30m --config /opt/appdata/plexguide/rclone.conf
+ grep -q gcrypt: /opt/appdata/plexguide/rclone.conf
+ rclone size gcrypt: --verbose=1 --fast-list --retries 3 --no-update-modtime --timeout=30m --config /opt/appdata/plexguide/rclone.conf
+ grep -q tcrypt: /opt/appdata/plexguide/rclone.conf
+ rclone size tcrypt: --verbose=1 --fast-list --retries 3 --no-update-modtime --timeout=30m --config /opt/appdata/plexguide/rclone.conf
 
M

MrDoob

Guest
Here another pr00f or work

THAT'S AN PR00F OF WORK DONT USE THE CODE BELOW !!!!

For pr00f is change the word gdrive/tdrive to gDrive/tDrive and now it will be skipped !!

Why it's don't match with the file !

Bash:
bash -x test.sh          + test=/opt/appdata/plexguide/rclone.conf
+ grep -q gDrive: /opt/appdata/plexguide/rclone.conf
+ grep -q tDrive: /opt/appdata/plexguide/rclone.conf
+ grep -q gcrypt: /opt/appdata/plexguide/rclone.conf
+ rclone size gcrypt: --verbose=1 --fast-list --retries 3 --no-update-modtime --timeout=30m --config /opt/appdata/plexguide/rclone.conf
+ grep -q tcrypt: /opt/appdata/plexguide/rclone.conf
+ rclone size tcrypt: --verbose=1 --fast-list --retries 3 --no-update-modtime --timeout=30m --config /opt/appdata/plexguide/rclone.conf
 
M

MrDoob

Guest
@MrDoob @Admin9705 Please incorporate this when the next update is ready. I have been asked numerous times how to check this.
Weekend is the code in the PGui,

I dont know how do implemented this in the pgclone code. *?*

And it's must be run as crontab each weekend so you can monitoring the drive used space

But hey let me check what's also possible as space used ;)

/mnt/move/
/mnt/downloads/
/mnt/complete/
/mnt/incomplete/

Maybe all 30secs *?* if page reloaded *?*

What's missing *?*
 

Porkie

Senior Member
Staff
I edit the pgui block to add this, you may need to change the log name accordingly, I use unencryted in this example and I paste it under the emergent section but you can chose where you like.

Code:
?>
              </span></td>
            </tr>
          </tbody>
        </table>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tbody>
            <tr>
              <td width="90%" height="30" style="color: #E8DD06; font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'DejaVu Sans', Verdana, sans-serif; font-weight: bolder; font-size: large; text-align: left;"><br>
                Tdrive Usage Log</td>
            </tr>
          </tbody>
        </table>
        <table width="100%" height="44" border="1" align="center" cellpadding="5" cellspacing="0">
          <tbody>
            <tr>
              <td colspan="6" bgcolor="#000000" style="color: #F7F6F6; font-family: Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif; font-weight: bold; font-size: medium;"><span class="test" style="color: #FFFFFF; font-family: Segoe, 'Segoe UI', 'DejaVu Sans', 'Trebuchet MS', Verdana, sans-serif;">
                <?php $output = shell_exec('tail -n 1  /plexguide/tduncrypt.log | sed -e "/TDrive Log - Cycle/q"');
echo "<pre>$output</pre>";
 
M

MrDoob

Guest
I write a smaller version with an sed command for removing the :

"Total size: "
and now the folder for log are hardcoded
Bash:
#!/bin/bash

test="/opt/appdata/plexguide/rclone.conf"
log="/var/plexguide"


if grep -q "gdrive:" $test ; then
rclone size gdrive: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/gduncrypt.log
 sed -i 's/Total size: / /g' $log/gduncrypt.log
fi

if grep -q "tdrive:" $test ; then
 rclone size tdrive: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/tduncrypt.log
 sed -i 's/Total size: / /g' $log/tduncrypt.log
fi

if grep -q "gcrypt:" $test ; then
rclone size gcrypt: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/gdcrypt.log
 sed -i 's/Total size: / /g' $log/gdcrypt.log
fi

if grep -q "tcrypt:" $test ; then
rclone size tcrypt: \
 --verbose=1 \
 --fast-list \
 --retries 3 \
 --no-update-modtime \
 --timeout=30m \
 --config /opt/appdata/plexguide/rclone.conf >> $log/tdcrypt.log
 sed -i 's/Total size: / /g' $log/tdcrypt.log
fi
As zip my index.php file ;)
 

Attachments

Porkie

Senior Member
Staff
Your php index code doesnt ouput anything im afraid, well not for me. Mine does, also you shouldnt point to /var/plexguide/logname.log in the php as pgui doesnt see this folder and /var/plexguide is mapped to /plexguide in the container so you should use /plexguide/logname.log on a standard install of pgblitz.
 
M

MrDoob

Guest
Open the index file with notepad++ and see all log files are touched from /plexguide ;) and not /var/plexguide
 
Assists Greatly with Development Costs

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads


Development Donations

 

Top NZB NewsGroups!

Members - Up To a 58% Discount!

Trending

Online statistics

Members online
16
Guests online
115
Total visitors
131
Top