Issue with rclone running from cron

Yes. The output is from

which bash

There seems to be a difference in the paths. The working script has /bin/bash whereas this one has /usr/bin/bash

His issue is the script doesn't even fire though, which is most perplexing.

Bash location shouldn't matter really though as most systems have both:

[felix@gemini Movies]$ ls -al /bin/bash
-rwxr-xr-x. 1 root root 2187664 May 13 08:18 /bin/bash
[felix@gemini Movies]$ ls -al /usr/bin/bash
-rwxr-xr-x. 1 root root 2187664 May 13 08:18 /usr/bin/bash
[felix@gemini Movies]$

I still can't figure it out.. any ideas?

Atleast Ubuntu doesn't have it in both locations (checked on both 16.04 & 18.04).

And the error is that the binary is not found, not that the script is not found, since the stderr has the line number mentioned too.

@jiru Can you change it to /bin/bash and try ?

Oh the error is line 1 not found. You are correct. Great find!

@darthShadow @Animosity022

No dice:

root@omvdocker:~# crontab -l
30 * * * * ({ /srv/vaultfs/rootfs/storage/scripts/rclone/root/; } | tee /tmp/U9GhC8Gz09FCqrfo.stdout) 3>&1 1>&2 2>&3 | tee /tmp/U9GhC8Gz09FCqrfo.stderr
23 * * * * /opt/rclone/scripts/ >> /tmp/myjob.log 2>&1
#51 * * * * env >> /tmp/myjob.log
root@omvdocker:~# tail -f /tmp/myjob.log
/bin/sh: 1: /opt/rclone/scripts/ not found

Can you run the script from the command line?

Can you share the latest contents?

Yes, via sh /opt/rclone/scripts/

if pidof -o %PPID -x ""; then
echo $(date "+%Y/%m/%d %H:%M:%S")" WARN  : Cron attempted to start the move the local data mirror to vault: but the process is already running." >> /opt/rclone/logs/vault-upload.log
exit 1

echo $(date "+%Y/%m/%d %H:%M:%S")" INFO  : Cron started the rclone move subroutine" >> /opt/rclone/logs/vault-upload.log
# Move older local files to the cloud
rclone move \
/srv/dev-disk-by-label-Buffer/mirror/ vault: \
--log-level INFO \
--log-file /opt/rclone/logs/vault-upload.log \
--stats 0 \
--exclude-from /opt/rclone/exclude/gvault \
--drive-chunk-size 64M \
--delete-empty-src-dirs \
--user-agent gvaultapp \

I think sh puts in the sh shell rather than using the first line.

Can you just run it with:


and does that work?

I meant changing the path in the script itself. The first line is /usr/bin/bash. Can you try with /bin/bash instead ?

Here's the output:

root@omvdocker:~# /opt/rclone/scripts/
-bash: /opt/rclone/scripts/ /usr/bin/bash: bad interpreter: No such file or directory

Yeah, @darthShadow is spot on. Change that to /bin/bash instead of /usr/bin/bash

Or make a backup and reinstall the os.
Also you can try this script on one vps like vutlr.

That indeed was the solution.

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