I am trying to run my rclone script through task scheduler, but I keep getting 0x1 errors. The script works when run manually, but never works when run through task scheduler.
What is your rclone version (output from rclone version)
1.v56.1
Which cloud storage system are you using? (eg Google Drive)
Google Drive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
This is the output of the .bat file which is being run:
as for task scheduler, I have run with highest privileges set. configure for is set for Server 2012 R2 (which is what the server is). Run whether user is logged on or not is selected. When I run the task manually through task scheduler (or if its run as a scheduled task) it immediately fails and gives me a "last run result" of (0x1). When run manually as a batch file, it works great.
I've tried so many different things at this point to try and get this to work but i'm at a point where I have no idea what else to try! I can get batch files to work fine without rclone commands in it, but whenever it needs to run anything through rclone I get these errors and the script doesn't run.
The rclone config contents with secrets removed.
I'm not sure what this means
A log from the command with the -vv flag
I don't think task scheduler is even running the thing. The script runs fine when run manually.
That ran successfully with the following log file output:
2021/11/01 17:19:16 DEBUG : rclone: Version "v1.56.1" starting with parameters ["rclone" "version" "--log-level=DEBUG" "--log-file=C:\Program Files\rclone-v1.56.1-windows-amd64\log.txt"]
2021/11/01 17:19:16 DEBUG : rclone: Version "v1.56.1" finishing with parameters ["rclone" "version" "--log-level=DEBUG" "--log-file=C:\Program Files\rclone-v1.56.1-windows-amd64\log.txt"]
I added rclone version --log-level=DEBUG --log-file="C:\Program Files\rclone-v1.56.1-windows-amd64\log.txt" to the top of my batch file to see if the batch file would run with this line. I still got the same error 0x1 through task scheduler but it did seem that this debug line worked so task scheduler is at least running the script, just not the sync commands.
Thanks! Sorry for the late response, I was able to use the output of this log to figure out and resolve the issue!
2021/11/02 10:16:58 DEBUG : rclone: Version "v1.56.1" starting with parameters ["rclone" "lsd" "Network:" "--dry-run" "--log-level=DEBUG" "--log-file=rclone.log"]
2021/11/02 10:16:58 DEBUG : Creating backend with remote "Network:"
2021/11/02 10:16:58 NOTICE: Config file "C:\Users\svcnetwork\AppData\Roaming\rclone\rclone.conf" not found - using defaults
2021/11/02 10:16:58 Failed to create file system for "Network:": didn't find section in config file
It seems that the service account I was using for task scheduler needed the rclone.conf file in its user directory. I copied it over from my account over to the service accounts directory and everything now works!