What's new
PGBlitz.com

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

Guides copyto.sh / script and service

M

MrDoob

Guest
so boys and girls a build a copy to script over rclone commands

here we go ...

Bash:
[email protected] /mnt/scripte # cat copyto.sh
#!/bin/bash

while [ 1 ]; do

echo "" >> /mnt/log/moveto.log
echo "" >> /mnt/log/moveto.log
echo "----------------------------" >> /mnt/log/moveto.log
echo "PG Blitz Log - First Startup" >> /mnt/log/moveto.log


  rclone moveto "/mnt/down/FILME-HD/" "/mnt/complete/FILME-HD/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --use-server-modtime \
  --transfers 6 \
  --min-age=3h \
  --exclude="**_HIDDEN~" --exclude=".unionfs/**" \
  --exclude='**partial~' --exclude=".unionfs-fuse/**" \
  --exclude=".fuse_hidden**" \
  --exclude="**sabnzbd**" --exclude="**nzbget**" \
  --exclude="**qbittorrent**" --exclude="**rutorrent**" \
  --exclude="**deluge**" --exclude="**transmission**" \
  --exclude="**jdownloader**" --exclude="**makemkv**" \
  --exclude="**handbrake**" --exclude="**bazarr**" \
  --exclude="**ignore**"  --exclude="**inProgress**"

  rclone moveto "/mnt/down/SERIEN/" "/mnt/complete/SERIEN/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --use-server-modtime \
  --transfers 6 \
  --min-age=3h \
  --exclude="**_HIDDEN~" --exclude=".unionfs/**" \
  --exclude='**partial~' --exclude=".unionfs-fuse/**" \
  --exclude=".fuse_hidden**" \
  --exclude="**sabnzbd**" --exclude="**nzbget**" \
  --exclude="**qbittorrent**" --exclude="**rutorrent**" \
  --exclude="**deluge**" --exclude="**transmission**" \
  --exclude="**jdownloader**" --exclude="**makemkv**" \
  --exclude="**handbrake**" --exclude="**bazarr**" \
  --exclude="**ignore**"  --exclude="**inProgress**"

  echo "Cycle  - Sleeping for 3 hours " >> /mnt/log/moveto.log
  cat /mnt/log/moveto.log | tail -200 > cat /mnt/log/moveto.log
  #sed -i -e "/Duplicate directory found in destination/d" /mnt/log/moveto.log

  sleep 3h

#exit 0

done
the next step is

how to run this as a service ^^

so here we go

Code:
cd /etc/systemd/system  && cp pgblitz.service copyto.service
Code:
nano copyto.service
Bash:
[Service]
User=0
Group=0
Type=simple
ExecStart=/bin/bash /mnt/scripte/copyto.sh
KillMode=process

[Install]
WantedBy=multi-user.target
and at last


service copyto start


and now have fun with this one ;DD

you can edit the paths and the locations ; but i use this ^^ ... so happy trading
 
Last edited by a moderator:
M

MrDoob

Guest
I use a cache - drive ..
My server have 2 x 4 TB and 1 x 240GB SSD

Sou you can move the downloads [ torrent ] between the HDD.
Without losing the seed files..

So I can use 1 x 4 TB as feeder HDD and the another 4 TB as cache / unpack drive.

After this command I add my unpack /rename script.

The I edit the Pgblitz.sh file and the pgunion.sh / rclone.conf file.


That's only pick the files from

/mnt/cache to upload.
If file older then 48h and space under 75% of the HDD then pick the oldest file nfor uploading .


I build my own scripts for this one.

So I can safe api request .

But for this one you need space and time all service must be restarted and some changes.

This one can use for files between feeder hdd and upload hdd to moving or cloning ..

For some torrent use really interesting .
 

Cyb3rGh05t

Senior Member
hey,

thanks for sharing your script.

i have a question:

i get the error while looking at the status of the service

Code:
Apr Apr 25 08:16:27 bumblebee bash[21477]: cat: write error: Broken pipe
do you know what could be wrong?

my script looks like this

Code:
#!/bin/bash

while [ 1 ]; do

echo "" >> /mnt/log/moveto.log
echo "" >> /mnt/log/moveto.log
echo "----------------------------" >> /mnt/log/moveto.log
echo "PG Blitz Log - First Startup" >> /mnt/log/moveto.log


  rclone moveto "/mnt/downloads/jdownloader2/" "/mnt/move/uploads/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --use-server-modtime \
  --transfers 6 \
  --min-age=3h \
  --exclude="**_HIDDEN~" --exclude=".unionfs/**" \
  --exclude='**partial~' --exclude=".unionfs-fuse/**" \
  --exclude=".fuse_hidden**" \
  --exclude="**sabnzbd**" --exclude="**nzbget**" \
  --exclude="**qbittorrent**" --exclude="**rutorrent**" \
  --exclude="**deluge**" --exclude="**transmission**" \
  --exclude="**jdownloader**" --exclude="**makemkv**" \
  --exclude="**handbrake**" --exclude="**bazarr**" \
  --exclude="**ignore**"  --exclude="**inProgress**"

  echo "Cycle  - Sleeping for 3 hours " >> /mnt/log/moveto.log
  cat /mnt/log/moveto.log | tail -200 > cat /mnt/log/moveto.log
  #sed -i -e "/Duplicate directory found in destination/d" /mnt/log/moveto.log

  sleep 3h

#exit 0

done
thanks for helping
 
M

MrDoob

Guest
sudo mkdir /mnt/log/ && sudo chown -cR 1000:1000 /mnt/log/

sudo service copyto stop && sudo service copyto start
 
M

MrDoob

Guest
Here with filebot included.. the same way

But please not this is more then custom one.

Please handle with care and change the folder

Dont use !!!!!!

/mnr/downloads/ this file will be automatically uploaded to G/TDrive over the pgblitz.sh.

Bash:
[email protected] /mnt/down # cat /mnt/scripte/copyto.sh
#!/bin/bash

while [ 1 ]; do

rm /var/plexguide/moveto.log

echo "" >> /var/plexguide/moveto.log
echo "----------------------------" >> /var/plexguide/moveto.log
echo "PG Blitz Log - First Startup" >> /var/plexguide/moveto.log


  rclone moveto "/mnt/down/FILME-HD/" "/mnt/complete/FILME-HD/" \  --log-file=/var/plexguide/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 24h \
  --exclude="**_HIDDEN~" --exclude=".unionfs/**" \
  --exclude='**partial~' --exclude=".unionfs-fuse/**" \
  --exclude=".fuse_hidden**" \
  --exclude="**sabnzbd**" --exclude="**nzbget**" \
  --exclude="**qbittorrent**" --exclude="**rutorrent**" \
  --exclude="**deluge**" --exclude="**transmission**" \
  --exclude="**jdownloader**" --exclude="**makemkv**" \
  --exclude="**handbrake**" --exclude="**bazarr**" \
  --exclude="**ignore**"  --exclude="**inProgress**"

  rclone moveto "/mnt/down/SERIEN/" "/mnt/complete/SERIEN/" \
  --log-file=/var/plexguide/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 24h \
  --exclude="**_HIDDEN~" --exclude=".unionfs/**" \
  --exclude='**partial~' --exclude=".unionfs-fuse/**" \
  --exclude=".fuse_hidden**" \
  --exclude="**sabnzbd**" --exclude="**nzbget**" \
  --exclude="**qbittorrent**" --exclude="**rutorrent**" \
  --exclude="**deluge**" --exclude="**transmission**" \
  --exclude="**jdownloader**" --exclude="**makemkv**" \
  --exclude="**handbrake**" --exclude="**bazarr**" \
  --exclude="**ignore**"  --exclude="**inProgress**"

  echo "Cycle  - Sleeping for 3 hours " >> /var/plexguide/moveto.log
  cat /var/plexguide/moveto.log | tail -200 > cat /var/plexguide/moveto.log
  #sed -i -e "/Duplicate directory found in destination/d" /mnt/log/moveto.log

  sleep 30

#Function
AC=find
NM=-name
MD=-maxdepth
EP=-empty

#############################################
## -def plex host:token
PT=$(cat /var/plexguide/plex.token)
PH=plex

#############################################

#ORDNER
DIR1=/mnt/complete
OUT=/mnt/cache
SCP=/mnt/scripte
FBOT=/mnt/filebot

#############################################

#unPACK 

 $AC $DIR1 $MD 8 $NM "*.rar" -execdir unrar x -o- {} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.sfv" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.txt" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.xml" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample" -exec rm -rf {} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Proof" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Cover" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Subs" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*jpg" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*jpeg" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*-sample.mkv" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens*" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Covers*" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.nfo" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*samp*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.png" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 15 -mindepth 1  $NM "*.r[a0-9][r0-9]" -type f -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "subs" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 "#" -exec -type -f -exec rm -rf \{} \; >> /mnt/log/moveto.log

#nfo clean

 $AC $DIR1 $MD 15 $NM "*.nfo" -type f -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log
 $AC /mnt/down/ -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log
 $AC /mnt/cache/ -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log

#############################################
##Rechte setzten
chown -cR mrdoob:mrdoob $DIR1 >> /mnt/log/moveto.log
chmod 750 $DIR1 >> /mnt/log/moveto.log


##rename-files
#python3 $SCP/rename.py $DIR1/FILME-HD/
#python3 $SCP/rename.py $DIR1/FILME-SD/
#############################################

# --def plex = host: token erneut zu scannen

#Sagen Sie der angegebenen Plex-Instanz, dass sie ihre Bibliothek erneut scannen soll.
#Plex Home-Instanzen erfordern ein Authentifizierungstoken .

# --def plex = host: token erneut zu scannen

#PT=cat /var/plexguide/plex.token)
#PH=http://localhost:32400

##filebot-running

#Serien
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/SERIEN/" -non-strict --conflict override --format "$OUT/{plex}" --db TheTVDB >> /mnt/log/moveto.log
#Anime
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/ANIME/" -non-strict --conflict override --format "$OUT/{plex}" --db AniDB >> /mnt/log/moveto.log
#Filme-1080p
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/FILME-HD/" -non-strict --conflict override --format "$OUT/Movies/{n} ({y})/{n} ({y})" --db TheMovieDB >> /mnt/log/moveto.log

#reCeeate folder
#mkdir $DIR1/{FILME-HD,SERIEN}

#rights
chown -cR mrdoob:mrdoob /mnt/cache >> /mnt/log/moveto.log

  sleep 3h

#exit 0

done
 

Cyb3rGh05t

Senior Member
Thanks for sharing this one..

You say that i can't use /mnt/downloads
but is /mnt/downloads/jdownloader2 good to use? or do i need to create a new folder inside /mnt ?

tanks again
 
Last edited:
M

MrDoob

Guest
Thanks for sharing this one..

You say that i can't use /mnt/downloads
but is /mnt/downloads/jdownloader2 good to use? or do i need to create a new folder inside /mnt ?

tanks again
I use /mnt/down

For my downloads all !!

mkdir /mnt/down && chown -cR 1000:1000 /mnt/down

And for complete files

mkdir /mnt/complete && chown -cR 1000:1000 /mnt/complete

The filebot script pick the files from */complete/{sub-folder}

Sorted by SERIEN ( TV ) and FILME-HD ( movies )

I unpack the files in this folder and move it over the script to /cache/{plex-conform-folder-name}/*

My pgblitz.sh custom

Bash:
......

chown -R 1000:1000 "$dlpath/move"
chown -R 1000:1000 "$dlpath/pgblitz/upload"
chmod -R 775 "$dlpath/move"
chown -R 775 "$dlpath/pgblitz"
chown -R 1000:1000  "/mnt/cache"
chmod -R 775 "/mnt/cache"

........


  rclone moveto "/mnt/cache/" "$dlpath/pgblitz/upload/" \
  --config /opt/appdata/plexguide/rclone.conf \
  --log-file=/var/plexguide/logs/pgblitz.log \
  --log-level INFO --stats 5s --stats-file-name-length 10 \
  --min-age 7d \
..........

# Remove empty directories
find "/mnt/cache" -mindepth 2 -mmin +5 -type d -empty -delete
........
The .... is tail command just find the right line...

I use for my plex server a /mnt/cache folder with 4 TB space
( one 4 TB HDD is mounted over fstab as /mnt/cache )
Dont use it , if you dont have enough space for this one.
Normally my */cache/ drive is filled round 60 - 70% of 4 TB space

In my pgunion is the "/mnt/cache" included as

Bash:
mergerfs -o func.getattr=newest,category.create=ff,direct_io,use_ino,atomic_o_trunc,big_writes,default_permissions,splice_move,splice_read,splice_write,allow_other,sync_read,minfreespace=0,umask=002,gid=1000,uid=1000,fsname=pgunion \
$dlpath/downloads=RW:/mnt/cache=RW:$dlpath/pgblitz/upload=NC:$dlpath/move=RW: ......  /mnt/unionfs
Here the ..... is blushed why .. I mount actually 3 TDrives in my pgunion commands
-------
in the rclone file

Bash:
[pgunion]
type = union
remotes = gdrive: tdrive: gcrypt: tcrypt: /mnt/move /mnt/cache ......
Here the ... is blushed why .. I mount actually 3 TDrives in my rclone.conf commands
------
In jdownloader you just specify the folder
Code:
[email protected] /mnt/down # ls
FILME-HD  jdownloader2  music  SERIEN
Auto.pick for filebot is not possible
 
M

MrDoob

Guest
new copyto.sh files / recreate with small fix for faster catching

Bash:
[email protected] /mnt/scripte # cat copyto.sh
#!/bin/bash

while [ 1 ]; do

rm /var/plexguide/moveto.log

echo "" >> /var/plexguide/moveto.log
echo "----------------------------" >> /var/plexguide/moveto.log
echo "PG Blitz Log - First Startup" >> /var/plexguide/moveto.log

  rclone moveto "/mnt/down/FILME-HD/" "/mnt/complete/FILME-HD/" \
  --log-file=/var/plexguide/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 24h \
  --use-server-modtime

  rclone moveto "/mnt/down/SERIEN/" "/mnt/complete/SERIEN/" \
  --log-file=/var/plexguide/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 24h \
  --use-server-modtime

  rclone moveto "/mnt/down/ANIME/" "/mnt/complete/ANIME/" \
  --log-file=/var/plexguide/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 24h \
  --use-server-modtime

  echo "Cycle  - Sleeping for 3 hours " >> /var/plexguide/moveto.log

  sleep 30

#Function
AC=find
NM=-name
MD=-maxdepth
EP=-empty

#############################################
## -def plex host:token
PT=$(cat /var/plexguide/plex.token)
PH=plex

#############################################

#ORDNER
DIR1=/mnt/complete
OUT=/mnt/cache
SCP=/mnt/scripte
FBOT=/mnt/filebot

#############################################

#Ausführung unPACK FILME-SD
 $AC $DIR1 $MD 8 $NM "*.rar" -execdir unrar x -o- {} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*.sfv" -exec rm -f \{\} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*.txt" -exec rm -f \{\} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*.xml" -exec rm -f \{\} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample" -exec rm -rf {} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Proof" -type d -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens" -type d -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Cover" -type d -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Subs" -type d -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*jpg" -exec rm -f \{\} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*jpeg" -exec rm -f \{\} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*-sample.mkv" -exec rm -f \{\} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample" -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens*" -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Covers*" -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*.nfo" -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample*" -exec rm -f \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample*" -exec rm -f \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*samp*" -exec rm -f \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "*.png" -exec rm -f \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 15 -mindepth 1  $NM "*.r[a0-9][r0-9]" -type f -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 $NM "subs" -type d -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 $MD 8 "#" -exec -type -f -exec rm -rf \{} \; >> /var/plexguide/moveto.log

#nfo clean

 $AC $DIR1 $MD 15 $NM "*.nfo" -type f -exec rm -rf \{} \; >> /var/plexguide/moveto.log
 $AC $DIR1 -mindepth 2 -type d $EP -exec rmdir \{} \; >> /var/plexguide/moveto.log
 $AC /mnt/down/ -mindepth 2 -type d $EP -exec rmdir \{} \; >> /var/plexguide/moveto.log
 $AC /mnt/cache/ -mindepth 2 -type d $EP -exec rmdir \{} \; >> /var/plexguide/moveto.log

#############################################

##Rechte setzten
sudo chown -cR mrdoob:mrdoob $DIR1 >> /var/plexguide/moveto.log
sudo chmod -R 755 $DIR1 >> /var/plexguide/moveto.log
#############################################

##rename-files
#python3 $SCP/rename.py $DIR1/FILME-HD/
#python3 $SCP/rename.py $DIR1/FILME-SD/
#############################################

# --def plex = host: token erneut zu scannen

#Sagen Sie der angegebenen Plex-Instanz, dass sie ihre Bibliothek erneut scannen soll.
#Plex Home-Instanzen erfordern ein Authentifizierungstoken .

# --def plex = host: token erneut zu scannen

#PT=cat /var/plexguide/plex.token)
#PH=http://localhost:32400

##filebot-running

#Serien
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/SERIEN/" -non-strict --conflict override --format "$OUT/{plex}" --db TheTVDB >> /var/plexguide/moveto.log
#Anime
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/ANIME/" -non-strict --conflict override --format "$OUT/{n}/Season {s}/{n} - {s00e00} - {t}" --db AniDB >> /var/plexguide/moveto.log
#Filme-1080p
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/FILME-HD/" -non-strict --conflict override --format "$OUT/Movies/{n} ({y})/{n} ({y})" --db TheMovieDB >> /var/plexguide/moveto.log

#reCeeate folder
#mkdir $DIR1/{FILME-HD,SERIEN}

#rights
chown -cR mrdoob:mrdoob /mnt/cache >> /mnt/log/moveto.log
chmod -R 755 /mnt/cache

  sleep 3h

done
___________________________
just change the name of the folder and the username

___________________________

copyto.sh PGui Solution



so boys if you want the copyto.sh log in your PGui

here the solution

add follow code in

1.) cd /opt/appdata/pgui
2.) cp index.php backup.index.php
3.) nano index.php

find line 69 / its behind =

// --> <?php $output = shell_exec('tail -n 25 /plexguide/logs/pgblitz.log | sed -e "/PG Blitz Log - Cycle/q"');

under | behind

press 1 x ENTER

then past the lines

</span></td>
</tr>
</tbody>
</table>

copyto.sh log

PHP:
        <table width="90%" 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; font-size: medium;">
                <?php $output = shell_exec('tail -n 25 /plexguide/moveto.log | sed -e "/PG Blitz Log - Cycle/q"');
echo "<pre>$output</pre>";
?>
              </span></td>
            </tr>
          </tbody>
        </table>
 

Cyb3rGh05t

Senior Member
do you know a script or a way how i can rename the files already stored on gdrive with filebot?

is this possible?

thanks in advance
 
M

MrDoob

Guest
do you know a script or a way how i can rename the files already stored on gdrive with filebot?

is this possible?

thanks in advance

Yes that's possible. just runs it as command only.

Bash:
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/SERIEN/" -non-strict --conflict override --format "$OUT/{plex}" --db TheTVDB >> /var/plexguide/moveto.log
Just change the folder an the $XXX to the right folder.

This lines must be changed to the right folder parts.
DIR1=/mnt/complete
OUT=/mnt/cache
SCP=/mnt/scripte
FBOT=/mnt/filebot


Sample:

$OUT = /mnt/unionfs/{plex}
 

Cyb3rGh05t

Senior Member
Yes that's possible. just runs it as command only.

Bash:
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/SERIEN/" -non-strict --conflict override --format "$OUT/{plex}" --db TheTVDB >> /var/plexguide/moveto.log
Just change the folder an the $XXX to the right folder.

This lines must be changed to the right folder parts.
DIR1=/mnt/complete
OUT=/mnt/cache
SCP=/mnt/scripte
FBOT=/mnt/filebot


Sample:

$OUT = /mnt/unionfs/{plex}
Yes that's possible. just runs it as command only.

Bash:
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/SERIEN/" -non-strict --conflict override --format "$OUT/{plex}" --db TheTVDB >> /var/plexguide/moveto.log
Just change the folder an the $XXX to the right folder.

This lines must be changed to the right folder parts.
DIR1=/mnt/complete
OUT=/mnt/cache
SCP=/mnt/scripte
FBOT=/mnt/filebot


Sample:

$OUT = /mnt/unionfs/{plex}
thanks for helping :)

do you mean like this:

Code:
#!/bin/bash
###############################################################################
# Title: PlexGuide ( filebot renamer )
#
# Author(s): Admin9705 - Deiteq Coder : MrDoob - freelance Coder URL: https://plexguide.com -
# http://github.plexguide.com GNU: General Public License v3.0E
#
################################################################################

# folders for execude

DIR=/mnt/unionfs/PlexMedia/Movies/MarvelCollection
OUT=/mnt/unionfs/filebot
SCP=/mnt/scripts
FBOT=/mnt/filebot

##############################################################################

############################################################################

##filebot-running

#Tv-Shows
#bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR/tv/" -non-strict --conflict auto --format "$OUT/{plex}" --db TheTVDB >> /mnt/log/moveto.log

#Anime
#bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR/anime/" -non-strict --conflict override --format "$OUT/{plex}" --db AniDB >> /mnt/log/moveto.log

#movies
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/" -non-strict --conflict override --format "$OUT/marvel/{n} ({y})/{n} ({y})" --db TheMovieDB >> /mnt/log/rename.log

#musik
#bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR/musik/" -non-strict --conflict override --format "$OUT/musik/{media.genres}/{media.performer}/{media.album}/{media.track}" --db ID3

#######

exit 0
thank you
 
M

MrDoob

Guest
OUT=/mnt/unionfs/filebot


That's your output folder *?*
Here landing all renamed files*?*


Edit here is something wrong

$FBOT/scripts/renall.groovy "$DIR1/

Change to
$FBOT/scripts/renall.groovy "$DIR/

Remove the ^^ 1 ^^
 

Cyb3rGh05t

Senior Member
OUT=/mnt/unionfs/filebot


That's your output folder *?*
Here landing all renamed files*?*


Edit here is something wrong

$FBOT/scripts/renall.groovy "$DIR1/

Change to
$FBOT/scripts/renall.groovy "$DIR/

Remove the ^^ 1 ^^
OUT=/mnt/unionfs/filebot

yes thats the output folder.

ok thank you i didnt saw this error :)

one question:

i have for example an .srt called xxxx-ger-forced.srt in a movie folder. after filebot script it is renamed to {new title}.srt and the -ger-forced is removed.

how can i avoid this?
 

Cyb3rGh05t

Senior Member
also when i run your script , all new downloaded folder arent deleted after upload to gdrive.

how can i make this happening?

my script:

Code:
#!/bin/bash

while [ 1 ]; do

rm /mnt/log/moveto.log

echo "" >> /mnt/log/moveto.log
echo "----------------------------" >> /mnt/log/moveto.log
echo "-Rclone - Filebot Renaming - Gdrive Upload- Automisation" >> /mnt/log/moveto.log

#############################################
#RClone - File Transfer
#############################################

  rclone moveto "/mnt/downloads/jdownloader2/movies" "/mnt/complete/movies/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime

  rclone moveto "/mnt/downloads/jdownloader2/shows/" "/mnt/complete/shows/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime

  rclone moveto "/mnt/downloads/jdownloader2/anime/" "/mnt/complete/anime/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime

  echo "Cycle  - Sleeping for 3 hours " >> /mnt/log/moveto.log

  sleep 30

#############################################
#Functions
#############################################

AC=find
NM=-name
MD=-maxdepth
EP=-empty
#############################################

## -def plex host:token
PT=$(cat /var/plexguide/plex.token)
PH=plex

#############################################
#Folders
#############################################

DIR1=/mnt/complete
OUT=/mnt/renamed
SCP=/mnt/scripts
FBOT=/mnt/filebot

#############################################
#Package Clean-Up
#############################################

 $AC $DIR1 $MD 8 $NM "*.rar" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.sfv" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.txt" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.url" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.org" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.html" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.xml" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample" -exec rm -rf {} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Proof" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Kristallprinz" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Cover" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
#$AC $DIR1 $MD 8 $NM "Subs" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.jpg" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.jpeg" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*-sample.mkv" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens*" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Covers*" -exec rm -rf \{} \; >> /mnt/log/moveto.log
#$AC $DIR1 $MD 8 $NM "*.nfo" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*samp*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.png" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 15 -mindepth 1  $NM "*.r[a0-9][r0-9]" -type f -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "subs" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 "#" -exec -type -f -exec rm -rf \{} \; >> /mnt/log/moveto.log
 
 #NFO Clean
#############################################

#$AC $DIR1 $MD 15 $NM "*.nfo" -type f -exec rm -rf \{} \; >> /mnt/log/moveto.log
$AC $DIR1 -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log
$AC /mnt/complete/ -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log
$AC /mnt/renamed/ -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log

#############################################
#Set Rights
#############################################

sudo chown -cR plexuser:plexuser $DIR1 >> /mnt/log/moveto.log
sudo chmod -R 755 $DIR1 >> /mnt/log/moveto.log

#############################################
#Filebot renaming
#############################################

#Shows
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/shows/" -non-strict --conflict override --format "$OUT/shows/{n}/Season {s}/{n} - {s00e00}" --db TheTVDB >> /mnt/log/moveto.log

#Anime
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/anime/" -non-strict --conflict override --format "$OUT/anime/{n}/Season {s}/{n} - {s00e00} - {t}" --db AniDB >> /mnt/log/moveto.log

#Movies
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/movies/" -non-strict --conflict override --format "$OUT/movies/{n} ({y})/{n} ({y})" --db TheMovieDB >> /mnt/log/moveto.log

#############################################
#Set Rights
#############################################

chown -cR plexuser:plexuser /mnt/renamed >> /mnt/log/moveto.log
chmod -R 755 /mnt/renamed >> /mnt/log/moveto.log

#############################################
#Rclone - Gdrive Upload
#############################################

  rclone moveto "/mnt/renamed/" "/mnt/move/uploads/" \
    --log-file=/mnt/log/moveto.log \
    --log-level INFO --stats 5s --stats-file-name-length 0 \
    --transfers 6 \
    --min-age 3h \
    --use-server-modtime

#############################################
#############################################
#Recreate Folders
#############################################

mkdir $OUT/{movies,shows,anime} >> /mnt/log/moveto.log

  sleep 3h

done
 

Cyb3rGh05t

Senior Member
i followed your instructions and costumized a bit the script :

Code:
#!/bin/bash
###############################################################################
# Title: PlexGuide ( filebot renamer )
#
# Author(s): Admin9705 - Deiteq
# Coder : MrDoob - freelance Coder
# URL:  https://plexguide.com - http://github.plexguide.com
# GNU: General Public License v3.0E
#
################################################################################

while [ 1 ]; do

rm /mnt/log/moveto.log

echo "" >> /mnt/log/moveto.log
echo "----------------------------" >> /mnt/log/moveto.log
echo "RcloneMover / FilebotRenamer / GdriveUploader" >> /mnt/log/moveto.log

#############################################
#RClone - File Transfer
#############################################

  rclone moveto "/mnt/downloads/jdownloader2/movies/" "/mnt/complete/movies/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime


  rclone moveto "/mnt/downloads/jdownloader2/shows/" "/mnt/complete/shows/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime

  rclone moveto "/mnt/downloads/jdownloader2/anime/" "/mnt/complete/anime/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime
 
    rclone moveto "/mnt/downloads/jdownloader2/music/" "/mnt/complete/music/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --transfers 6 \
  --min-age 3h \
  --use-server-modtime

  echo "Cycle  - Sleeping for 3 hours " >> /mnt/log/moveto.log

 sleep 30

#############################################
#Functions
#############################################

AC=find
NM=-name
MD=-maxdepth
EP=-empty

#############################################
#Folders
#############################################

DIR=/mnt/downloads/jdownloader2
DIR1=/mnt/complete
OUT=/mnt/renamed
FBOT=/mnt/filebot

#############################################
#Package Clean-Up
#############################################

 $AC $DIR1 $MD 8 $NM "*.rar" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.sfv" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.txt" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.url" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.org" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.html" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.xml" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample" -exec rm -rf {} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Proof" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Kristallprinz" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Cover" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Subs" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
  $AC $DIR1 $MD 8 $NM "*.jpg" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.jpeg" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*-sample.mkv" -exec rm -f \{\} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Screens*" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Covers*" -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "Sample*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*sample*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*samp*" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "*.png" -exec rm -f \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 15 -mindepth 1  $NM "*.r[a0-9][r0-9]" -type f -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 $NM "subs" -type d -exec rm -rf \{} \; >> /mnt/log/moveto.log
 $AC $DIR1 $MD 8 "#" -exec -type -f -exec rm -rf \{} \; >> /mnt/log/moveto.log

#############################################
#Set Rights
#############################################

sudo chown -cR plexuser:plexuser $DIR1 >> /mnt/log/moveto.log
sudo chmod -R 755 $DIR1 >> /mnt/log/moveto.log

#############################################
#Filebot renaming
#############################################

#Shows
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/shows/" -non-strict --conflict override --format "$OUT/shows/{n}/Season {s}/{n} - {s00e00} - {t}" --db TheTVDB >> /mnt/log/moveto.l$

#Anime
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/anime/" -non-strict --conflict override --format "$OUT/anime/{n}/Season {s}/{n} - {s00e00} - {t}" --db AniDB >> /mnt/log/moveto.log

#Movies
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/movies/" -non-strict --conflict override --format "$OUT/movies/{n} ({y})/{n} ({y})" --db TheMovieDB >> /mnt/log/moveto.log

#Music
bash $FBOT/filebot.sh -script $FBOT/scripts/renall.groovy "$DIR1/music/" -non-strict --conflict override --format "$OUT/music/{media.genres}/{media.performer}/{media.album}/{media.track}" --db ID3$


#############################################
#Set Rights
#############################################

chown -cR plexuser:plexuser /mnt/renamed >> /mnt/log/moveto.log
chmod -R 755 /mnt/renamed >> /mnt/log/moveto.log

#############################################
#Rclone - Gdrive Upload
#############################################

  rclone moveto "/mnt/renamed/" "/mnt/move/uploads/" \
  --log-file=/mnt/log/moveto.log \
  --log-level INFO --stats 5s --stats-file-name-length 0 \
  --ignore-existing \
  --use-server-modtime \
  --transfers 6 \

#################################
#Delete Folders
#################################

$AC $DIR -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log
$AC $DIR1 -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log
$AC $OUT -mindepth 2 -type d $EP -exec rmdir \{} \; >> /mnt/log/moveto.log

#############################################
#Recreate Folders
#############################################

mkdir $OUT/{movies,shows,anime,music} >> /mnt/log/moveto.log
mkdir $DIR1/{movies,shows,anime,music} >> /mnt/log/moveto.log
mkdir $DIR/{movies,shows,anime,music} >> /mnt/log/moveto.log

#############################################
#Set Rights
#############################################

chown -cR plexuser:plexuser $OUT/{movies,shows,anime,music} >> /mnt/log/moveto.log
chmod -R 755 $OUT/{movies,shows,anime,music} >> /mnt/log/moveto.log
chown -cR plexuser:plexuser $DIR1/{movies,shows,anime,music} >> /mnt/log/moveto.log
chmod -R 755 $DIR1/{movies,shows,anime,music} >> /mnt/log/moveto.log
chown -cR plexuser:plexuser $DIR/{movies,shows,anime,music} >> /mnt/log/moveto.log
chmod -R 755 $DIR/{movies,shows,anime,music} >> /mnt/log/moveto.log

sleep 3h

#exit 0

done
but i need some help if u can..

it doesnt respect the --min-age 3hflag and it doesnt delete the moved folders.

somehow also it deletes new downloaded packages before moving them.

what do i miss in the script or how could i make it better?

could you help me out please?

thanks
 
M

MrDoob

Guest
Check the pgblitz.sh file for the last line and also the cloneclean.sh files

There was an issue inside

search here in the forum

/mnt/move removed or so

I mean was the name
 
M

MrDoob

Guest
And the next is dont use /mnt/downloads

Pgblitz will pick the files first !!!

Use this folder for jdownloader

sudo mkdir /mnt/down/{jdown}/{shows,movies,anime,music} && chown -cR 1000:1000 /mnt/down/

And edit jdownloader path to /mnt/down/jdown

So you can load the files without any issues in the pgblitz or clone clean
 

Cyb3rGh05t

Senior Member
And the next is dont use /mnt/downloads

Pgblitz will pick the files first !!!

Use this folder for jdownloader

sudo mkdir /mnt/down/{jdown}/{shows,movies,anime,music} && chown -cR 1000:1000 /mnt/down/

And edit jdownloader path to /mnt/down/jdown

So you can load the files without any issues in the pgblitz or clone clean
all right thank u
 

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
14
Guests online
167
Total visitors
181
Top