When setting up rclone with windows task scheduler, I'd like to have the script run whether the user is logged in or not from my server. Currently, if i select "run only when user is logged on" the script runs fine and executes at the desired specs.
If I select "Run whether user is logged on or not" the script "doesn't run" - task scheduler claims the task is running, and it has a log for scheduler claiming the task runs, however nothing is actually happening with rclone. I do see in task manager that it is attempting to run...but it isn't executing anything in the script.
What is your rclone version (output from rclone version)
Version 1.55.1
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Windows Server 2012 R2 64bit, Win 10 Pro 64bit (task issues are identical on both)
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)
To answer your question, I have a VBS file (to hide the cmd window) and it is pointed to a .CMD script.
the username the task runs as is my domain admin account.
The paths look as follows in my script:
P:\batch\rclone\rclone.exe copy "\location\on\network\share\Account Managers" "remote:Account Managers"
This works without issues if I double click on the script (whether the VBS or the CMD portion) - only have issues with task scheduler running that script for some reason.
Let me look into hard coding the location & logging.
Question: Do I hard code the config into the script?
keep in mind that windows keeps two isolated sets of network shares per user,
one set of user without admin privileges and one set for user with admin privileges.
so make sure the script can see the source
as a test, add a command such as dir \\location\on\network\share\Account Managers > list.txt
or
add a net use to the script
hard code the location of the rclone file. --config=c:\path\to\config\rclone.conf
I know my current path to the config file, but I'm having a hard time understanding how to hard code the path in.
When I attempt to add --config I get "usage" and "available commands" prompt.
Usage:
rclone [flags]
rclone [command]
Available Commands:
about Get quota information from the remote.
authorize Remote authorization.
backend Run a backend specific command.
cat Concatenates any files and sends them to stdout.
check Checks the files in the source and destination match.
cleanup Clean up the remote if possible.
config Enter an interactive configuration session.
copy Copy files from source to dest, skipping already copied.
copyto Copy files from source to dest, skipping already copied.
copyurl Copy url content to dest.
cryptcheck Cryptcheck checks the integrity of a crypted remote.
cryptdecode Cryptdecode returns unencrypted file names.
dedupe Interactively find duplicate filenames and delete/rename them.
delete Remove the contents of path.
deletefile Remove a single file from remote.
genautocomplete Output completion script for a given shell.
gendocs Output markdown docs for rclone to the directory supplied.
hashsum Produces a hashsum file for all the objects in the path.
help Show help for rclone commands, flags and backends.
link Generate public link to file/folder.
listremotes List all the remotes in the config file.
ls List the objects in the path with size and path.
lsd List all directories/containers/buckets in the path.
lsf List directories and objects in remote:path formatted for parsing.
lsjson List directories and objects in the path in JSON format.
lsl List the objects in path with modification time, size and path.
md5sum Produces an md5sum file for all the objects in the path.
mkdir Make the path if it doesn't already exist.
mount Mount the remote as file system on a mountpoint.
move Move files from source to dest.
moveto Move file or directory from source to dest.
ncdu Explore a remote with a text based user interface.
obscure Obscure password for use in the rclone config file.
purge Remove the path and all of its contents.
rc Run a command against a running rclone.
rcat Copies standard input to file on remote.
rcd Run rclone listening to remote control commands only.
rmdir Remove the path if empty.
rmdirs Remove empty directories under the path.
serve Serve a remote over a protocol.
settier Changes storage class/tier of objects in remote.
sha1sum Produces an sha1sum file for all the objects in the path.
size Prints the total size and number of objects in remote:path.
sync Make source and dest identical, modifying destination only.
touch Create new file or change file modification time.
tree List the contents of the remote in a tree like fashion.
version Show the version number.
Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.
Oh! Duh its at the end of the parameters, my mistake. Ok I configured it but it still doesn't seem to run in task scheduler with the "logged in or not" box checked - even when I'm signed on.
I'm sorry I'm rather new to scripting as you can probably tell. I created a new task for it in task scheduler and deleted the old one and it actually worked this time with the "logged in or not" box checked! I think we might be in the money as they call it, I'm gonna log myself out and see if it still runs but it looks promising! Thank you for all your help so far.
EDIT: Thanks a ton @asdffdsa, the script works without issues now and everything is working logged in or not. I really appreciate your time and patience.