Crontab not working

So I'm trying to automate my Rclone process. It works when running the script manually but it just doesnt work on crontab. I've already gone through multiple different forums and sites and nothing works. This is my script:


if pidof -o %PPID -x "$0"; then
exit 1

/usr/sbin/rclone move "/media/tom/Drive 1/Files/YouTubeDownloads/" "Dropbox:/YouTubeDownloads/"


To get to crontab I did:

su root

crontab -e

          • '/home/tom/'

I have other scripts in Crontab that work fine.

I suspect the space in Drive 1 needs to be escaped.

Try /media/tom/Drive\ 1/Files/YouTubeDownloads/

Edit, i missed the part about it already working when running the script manually. This happened to me. Make sure you have made the script executable with chmod +x /home/tom/

You can execute a shell manually without the +x flag, but cron will not be able to execute. So i think the chmod should do the trick.

Already done that man. No change.

What's the user you normally use? You need to use the same user that you normally do as opposed to using root.

What's the actual error you are seeing in the logs?

Actually since adding usr/bin/rclone it doesn't even run manually. Not a directory. I downloaded Rclone with the Swizzin Script, so were would it be located?

I'm not sure what a Swizzin script is.

You can:

felix@gemini:~$ which rclone

I always install from

Thats weird it still says that its in /usr/bin/rclone

Cron has no concept of paths and environment variables. I use a script and I specific rclone.conf location that I include with the script.

# RClone Config file

#exit if running
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then exit; fi

# Move older local files to the cloud
/usr/bin/rclone move /data/local/ gcrypt: --log-file /opt/rclone/logs/upload.log -v --exclude-from /opt/rclone/scripts/excludes --delete-empty-src-dirs --fast-list --max-transfer 700G

So you can put something in there to grab the log and see what the error is:

# Cloud Upload
12 3 * * * /opt/rclone/scripts/upload_cloud >> /tmp/test.log 2>&1

I think its the "Drive 1" that is messing it up. How do I write that when it has a space between it?

Can you run the script just from the command line and it works? The quotes should be fine.

No it wasn't working in command line, I had to add "Drive\ 1" for it to work. Will try crontab now

Yes its working. Thank you man! You are a god.

Freaky though. Do one of these not work on your OS?

felix@gemini:~$ ls "Drive 1"
felix@gemini:~$ ls Drive\ 1/
felix@gemini:~$ ls "Drive 1"/

Yeah they do. It was because I copied your script, so forgot to add quotes.

Ah thanks!

As a general rule of thumb, I personally try to avoid spaces and funky characters as it just makes thing harder than they need to be :slight_smile:

Happy you got it working!

Am I a god for suggesting it? Lol

Didn't end up using it in the end. But I didn't know you could do that.

I find anyone that helps to be godlike so you are a god to me if that helps :sunny:

Aww shucks. Communities are the best!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.