I use WIndows 10.
Could someone tell me what is the easier method to run RClone Sync since a script/notepad/file?
I use WIndows 10.
Could someone tell me what is the easier method to run RClone Sync since a script/notepad/file?
This is what I have in rcloneSync.bat file.
%comspec% /k rclone.exe sync Q:/ServerFolders/Plex GD-crypt: --config ./rclone.conf -v --progress --stats 5s --size-only
hi,
sorry, not sure what you mean, please describe, in detail, what you need help with.
hi,
%comspec% /k
, that is not needed.
the simplete script would be this, could call it rmount.cmd
rclone mount --vfs-cache-mode full jtm2021hyo:\ x: -v
and when running a script, might want to use --no-console
, which is hide the console windows
here is a more complex script, which can be used as a template for other scripts.
to run a batch file at boot time, using task scheduler, this would be a good batch file.
@set RCLONE_CONFIG_PASS=secrect.password
@set RCLONE_CONFIG=c:\data\rclone\rclone.conf
@set rcmd=c:\data\rclone\rclone.exe
@set logfile=c:\data\rclone\log.txt
@set log=--log-level=INFO --log-file=%logilfe%
@del %logfile%
%rcmd% mount jtm2021hyo:\ x: --vfs-cache-mode full --no-console %log%
True. But when I start a copy or sync running overnight, I like to be able to see the status when rclone finishes when I get up in the morning. This leaves the terminal window open.
another option, which i use, is pause
as that works with a script with a single command and with multiple commands.
rclone sync Q:/ServerFolders/Plex GD-crypt: ......
rclone cryptcheck Q:/ServerFolders/Plex GD-crypt: ......
pause
I like the remount.cmd script method.
Is there any python-rclone-script template to just edit/copy/paste my Rclone Mount command?
sorry, not sure what you are asking?
you want to run/execute a dos command via python?
i can provide examples of how to do that.
I would really appreciate a python sample running Rclone Mount command.
i have a python script that runs rclone, 7zip, fastcopy, and creates VSS snapshots
here are two ways to run any windows/dos command
i will simply copy and paste them into this post, as is.
you can tweak them to your use-case
the main point is that both use subprocess.run
this is a simple way. just change Cmd
to your command
Cmd = f'{ScriptsDir}\\swithmail.exe --to "{SwithMailEmailAddress}" --silent --xml "{SwithMailXMLFile}" --subject "rcloner Status={TheBackupStatus} BackupName={Com.BackupNameFull} HostName={Com.HostName} " --body "{BStatus}" --log {Com.BackupLogDir}\\sendmail.log'
x = subprocess.run(Cmd, cwd=ScriptsDir, capture_output=True, text=True)
and this is a more complex function
def DoCmd(self, Text, Cmd, Input='', Env=''):
try:
if Common.DebugMode:
Common.Log(self, f'DebugMode: DoCmd: {Text}={Cmd}')
return
Common.Log(self, f'DoCmd: Start: {Text}={Cmd}')
the_env = {}; the_env = dict(os.environ)
if Env != '': the_env.update(Env)
x=subprocess.run(Cmd, cwd=Common.ScriptsDir, capture_output=True, text=True, input=Input, env=the_env)
if len(x.stdout) != 0: xfile = open(f'{Common.BackupLogDir}\\{Text}.stdout.log', "w"); xfile.write(x.stdout); xfile.close()
if len(x.stderr) != 0: xfile = open(f'{Common.BackupLogDir}\\{Text}.stderr.log', "w"); xfile.write(x.stderr); xfile.close()
if x.returncode==0:
Common.Log(self, f'DoCmd: End: {Text}={Cmd}')
return x
else:
Common.DoEnd(self, f'ERROR: DoCmd: End {Text}={Cmd} with returncode={x.returncode}')
except Exception as exception:
Common.DoEnd(self, f'ERROR: DoCmd={Cmd} - {traceback.format_exc()}')
Your script looks cool, but a bit complex to understand.
I just want to use Commands like RClone Sync, RClone Mount, RClone Copy, and if possible, use a GUI created in pything script to help select any simple folder to update my GDrive.
import subprocess
import system
Cmd = rclone mount --vfs-cache-mode full JTM-PRO-01: C:\JTM\RCLONE\JTM-PRO=001\ -v
x = subprocess.run(Cmd, cwd=ScriptsDir, capture_output=True, text=True)
def DoCmd(self, Text, Cmd, Input='', Env=''):
try:
if Common.DebugMode:
Common.Log(self, f'DebugMode: DoCmd: {Text}={Cmd}')
return
Common.Log(self, f'DoCmd: Start: {Text}={Cmd}')
the_env = {}; the_env = dict(os.environ)
if Env != '': the_env.update(Env)
x=subprocess.run(Cmd, cwd=Common.ScriptsDir, capture_output=True, text=True, input=Input, env=the_env)
if len(x.stdout) != 0: xfile = open(f'{Common.BackupLogDir}\\{Text}.stdout.log', "w"); xfile.write(x.stdout); xfile.close()
if len(x.stderr) != 0: xfile = open(f'{Common.BackupLogDir}\\{Text}.stderr.log', "w"); xfile.write(x.stderr); xfile.close()
if x.returncode==0:
Common.Log(self, f'DoCmd: End: {Text}={Cmd}')
return x
else:
Common.DoEnd(self, f'ERROR: DoCmd: End {Text}={Cmd} with returncode={x.returncode}')
except Exception as exception:
Common.DoEnd(self, f'ERROR: DoCmd={Cmd} - {traceback.format_exc()}')
note: the function DoCmd is not needed.
just use the simple, two line version.
Cmd = rclone mount --vfs-cache-mode full JTM-PRO-01: C:\JTM\RCLONE\JTM-PRO=001\ -v
x = subprocess.run(Cmd, cwd=ScriptsDir, capture_output=True, text=True)
--- creating a GUI in python would be next level complex.
i made a choice not use a GUI, instead of read information from a .ini file
[en08_wasabi_veeam_br_en08]
SourceDir=v:\br_vserver03_en08
DestDirRclone=wasabi_vserver03brvserver03en08_remote:vserver03.br.vserver03.en08/en08
VShadow=true
RcloneCopyFiles=--immutable --stats=5h --fast-list --bind=192.168.62.233 --include="*.{vib,vbk}" --max-age=30d --s3-no-check-bucket=true
RcloneUseBackupDir=true
ProcessLogs=true
SendEmailLogs=true
#RcloneDryRun=true
#DebugMode=true
--- rclone, itself has a GUI, tho it is experinmenal
--- there is RcloneBrowser, that is stable and has a GUI.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.