What am I missing in Crontab executing the .cron files?

The .cron file works perfectly by itself manually when I do a "./movies.cron". This is the script for the .cron file:

#!/bin/bash
# RCLONE UPLOAD CRON TAB SCRIPT
# Type crontab -e and add line below (without # )
# * * * * * root /home/scripts/upload-tv.cron >/dev/null 2>&1

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

LOGFILE="/home/user/Documents/Logs/TVShows.log"
FROM="/home/user/Downloads/TVShows/AllTVShows/"
TO="Gdrive:Rclone/TVShows/All Shows/"

# CHECK FOR FILES IN FROM FOLDER THAT ARE OLDER THEN 15 MINUTES
if find $FROM -type f -mmin +15 | read*
** then**
** start=$(date +'%s')**
** echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD STARTED" | tee -a $LOGFILE**
** # MOVE FILES OLDER THEN 15 MINUTES**
** rclone move "$FROM" "$TO" --transfers=4 --checkers=4 --delete-empty-src-dirs --min-age 15m --log-file=$LOGFILE**
** echo "$(date "+%d.%m.%Y %T") RCLONE UPLOAD FINISHED IN $(($(date +'%s') - $start)) SECONDS"$ | tee -a $LOGFILE**
fi
exit

Here is my "crontab" format:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command

*** * * * * /home/user/Documents/Rclone/upload-TVShows1080.cron >/dev/null 2>&1**

I see in the logs crontab is running the command but it only last a second.
Syslog:
ul 18 10:48:01 seedbox CRON[25169]: (user) CMD (/home/user/Documents/Rclone/upload-TVShows1080.cron >/dev/null 2>&1)
Jul 18 10:48:23 seedbox crontab[25254]: (user) BEGIN EDIT (user)
Jul 18 10:49:01 seedbox CRON[25375]: (user) CMD (/home/user/Documents/Rclone/upload-TVShows1080.cron >/dev/null 2>&1)
Jul 18 10:49:24 seedbox pure-ftpd: (?@::1) [INFO] New connection from ::1
Jul 18 10:49:24 seedbox pure-ftpd: (?@::1) [INFO] Logout.
Jul 18 10:50:01 seedbox CRON[25568]: (root) CMD (/opt/thinlinc/sbin/tl-collect-licensestats)
Jul 18 10:50:01 seedbox CRON[25569]: (user) CMD (/home/user/Documents/Rclone/upload-TVShows1080.cron >/dev/null 2>&1)

Cron log:
18.07.2019 10:48:01 RCLONE UPLOAD STARTED
18.07.2019 10:48:01 RCLONE UPLOAD FINISHED IN 0 SECONDS$
18.07.2019 10:49:01 RCLONE UPLOAD STARTED
18.07.2019 10:49:01 RCLONE UPLOAD FINISHED IN 0 SECONDS$
18.07.2019 10:50:01 RCLONE UPLOAD STARTED
18.07.2019 10:50:01 RCLONE UPLOAD FINISHED IN 0 SECONDS$
18.07.2019 10:51:02 RCLONE UPLOAD STARTED
18.07.2019 10:51:02 RCLONE UPLOAD FINISHED IN 0 SECONDS$
18.07.2019 10:52:01 RCLONE UPLOAD STARTED
18.07.2019 10:52:01 RCLONE UPLOAD FINISHED IN 0 SECONDS$

You can use three backtics to setup a block that is code by putting them at the start of a line and at the end.

Something like

script here

In cron jobs, you want to use full paths like /usr/bin/rclone. You are double dipping on commands too so I'd remove the find and just use the rclone min-age if that is what you are going for.

Try running the command rclone move with --dry-run with on variables and just put the info in and see what it does so like:

rclone move "/home/user/Downloads/TVShows/AllTVShows/" "Gdrive:Rclone/TVShows/All Shows/" --transfers=4 --checkers=4 --delete-empty-src-dirs --min-age 15m --dry-run -v

Was there supposed to be something when you have "script here"?

It was an example of how to use the backtics.

I ran it and below is what I got:

user@seedbox:~/Documents/Rclone$ rclone move "/home/user/Downloads/TVShows/AllTVShows/" "Gdrive:Rclone/TVShows/All Shows/" --transfers=4 --checkers=4 --delete-empty-src-dirs --min-age 15m --dry-run -v
2019/07/18 17:12:34 Failed to create file system for "Gdrive:Rclone/TVShows/All Shows/": didn't find section in config file
user@seedbox:~/Documents/Rclone$

Can you post your rclone.conf with out keys/passwords?

It looks like you are missing or have a remote named wrong?

Yeah looking at it I think I do have something wrong

[Google]
type = drive
client_id =
client_secret =
scope = drive
root_folder_id =
service_account_file =
token =

Yep, your remote name is "Google" so you want to replace GDrive: with Google:

So to test:

rclone move "/home/user/Downloads/TVShows/AllTVShows/" "Google::Rclone/TVShows/All Shows/" --transfers=4 --checkers=4 --delete-empty-src-dirs --min-age 15m --dry-run -v

2019/07/18 18:40:51 INFO : Google drive root ':Rclone/TVShows/All Shows': Modify window is 1ms
2019/07/18 18:40:51 ERROR : : error reading source directory: directory not found
2019/07/18 18:40:51 INFO : Google drive root ':Rclone/TVShows/All Shows': Waiting for checks to finish
2019/07/18 18:40:51 INFO : Google drive root ':Rclone/TVShows/All Shows': Waiting for transfers to finish
2019/07/18 18:40:51 ERROR : Attempt 1/3 failed with 1 errors
2019/07/18 18:40:52 ERROR : : error reading source directory: directory not found
2019/07/18 18:40:52 INFO : Google drive root ':Rclone/TVShows/All Shows': Waiting for checks to finish
2019/07/18 18:40:52 INFO : Google drive root ':Rclone/TVShows/All Shows': Waiting for transfers to finish
2019/07/18 18:40:52 ERROR : Attempt 2/3 failed with 1 errors
2019/07/18 18:40:52 ERROR : : error reading source directory: directory not found
2019/07/18 18:40:52 INFO : Google drive root ':Rclone/TVShows/All Shows': Waiting for checks to finish
2019/07/18 18:40:52 INFO : Google drive root ':Rclone/TVShows/All Shows': Waiting for transfers to finish
2019/07/18 18:40:52 ERROR : Attempt 3/3 failed with 1 errors
2019/07/18 18:40:52 INFO :
Transferred: 0 Bytes (0 Bytes/s)
Errors: 1
Checks: 0
Transferred: 0
Elapsed time: 1.8s

That error is telling your source directory doesn't seem to exist.

Is that the right path?

Yes it is. Its also saying that the command is not found.

I am wondering if there is a difference in rclone and rclone browser? I have Rclone Browser installed. Before they reloaded my seedbox I had both installed.

Nope still did not work

I think I finally figured it out. In the crontab I put "root" in and the crontab is working now. Files are being moved because on my seedbox their disappearing.

        • root /home/user/Documents/Rclone/upload-TVShows1080.cron >/dev/null 2>&1

From the log:

18.07.2019 21:53:01 RCLONE UPLOAD FINISHED IN 0 SECONDS$
18.07.2019 21:54:01 RCLONE UPLOAD STARTED
18.07.2019 21:54:01 RCLONE UPLOAD FINISHED IN 0 SECONDS$
18.07.2019 21:55:02 RCLONE UPLOAD STARTED

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