Run Filebot node every 6 hours.

How-to guides, frequently asked questions, not-so-obvious features, etc
Post Reply
spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Run Filebot node every 6 hours.

Post by spikemixture » 20 Jul 2019, 13:43

Code: Select all

0 */6 * * */opt/filebot-node/task 1
I have in the crontab file.

Not working!
What have I done wrong?

Should it be just task?

or should it be run ?

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 20 Jul 2019, 13:57

No space between * and /command would be the first obvious issue.

This might help:
https://crontab-generator.org/


EDIT:

Here's a crontab line that definitely works since I'm using it on my QNAP test device for nightly test runs:

Code: Select all

0 4 * * * /share/homes/admin/scripts/nightly.sh > /share/homes/admin/scripts/nightly.log 2>&1
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 21 Jul 2019, 03:02

rednoah wrote:
20 Jul 2019, 13:57
No space between * and /command would be the first obvious issue.

This might help:
https://crontab-generator.org/


EDIT:

Here's a crontab line that definitely works since I'm using it on my QNAP test device for nightly test runs:

Code: Select all

0 4 * * * /share/homes/admin/scripts/nightly.sh > /share/homes/admin/scripts/nightly.log 2>&1
I am confident the actual crontab bit is correct as have used a similar site/app
And the /opt/filebot-node/task 1 comes from the tip under schedule in filebot-node !

0 */6 * * */opt/filebot-node/task 1

And cannot see where the space is between * and /

What is the command to make this run ?
task?
task 1 ?
run ?

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 21 Jul 2019, 04:50

1.
I'd start with something that is known to work. Once we have something that works, we can modify it step by step, while ensuring that it keeps working after each step, until it works the way we want.


2.
As for the missing space, there needs to be a space between each column of the space-separated table:

Code: Select all

# NO
0 */6 * * */opt/filebot-node/task 1
# MAYBE
0 */6 * * * /opt/filebot-node/task 1

3.
You can manually run this command, but running this command:

Code: Select all

/opt/filebot-node/task 1
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 21 Jul 2019, 08:39

Manually works and have now got the space so it looks like this

Code: Select all

0 */6 * * * /opt/filebot-node/task 1
Will it show in the filebot-node GUI under tasks when/if it runs?

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 21 Jul 2019, 08:53

Yes, it'll show up.

However, it is always good practice to redirect all console output to some file, so you get all console output, and errors, just in case something goes wrong before filebot is even started:

Code: Select all

0 */6 * * * /opt/filebot-node/task 1 > /path/to/some/file.log 2>&1
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 22 Jul 2019, 04:21

Nothing for 12 hours

Code: Select all

0 */6 * * * /opt/filebot-node/task 1 > /share/CACHEDEV2_DATA/AAAdata/BACKUPS/crontab.log 1>&1
I have created a file called crontab.log in that location and given it permissions

how's that look

What is the number at the end of your example ? Does the log # match the instruction number?

I have added an hourly one also .

Code: Select all

0 */1 * * * /opt/filebot-node/task 2 > /share/CACHEDEV2_DATA/AAAdata/BACKUPS/crontab.log 2>&1

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 22 Jul 2019, 04:43

If the command is wrong. You will get an error. If the number is wrong. You will get an error. Nothing means that your cron job was never called for some reason.

The first step is to get cron to call your script (any script, not necessarily anything related to filebot) and then take it from there:
viewtopic.php?f=4&t=3067
:idea: Please read the FAQ and How to Request Help.

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 22 Jul 2019, 04:48

:idea: I recommend a systematic step-by-step approach to problem solving, such as the following.


1.
TEST: Call date every minute and write to log:

Code: Select all

* * * * * date > /path/to/log 2>&1
VERIFY:

Code: Select all

cat /path/to/log
:idea: We have now verified that cron is working.


2.
TEST: Call our own script that just calls date every minute and write to log:

Code: Select all

* * * * * /path/to/script.sh > /path/to/log 2>&1
VERIFY:

Code: Select all

cat /path/to/log
:idea: We have now verified that we can call our own script that runs our own commands.


3.
Change cron tab to every 6 hours instead of every minute. Check if it works.

:idea: We now have a script that is called every 6 hours.


4.
Add any filebot / filebot-node-task command you want to that script that we know is successfully being called every 6 hours.

:idea: We now have a script that calls filebot which is run by cron every 6 hours. Success!
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 22 Jul 2019, 07:07

1. TEST:
/opt/filebot-node/task 1 yes this works


/opt/filebot-node/task 1 > /share/CACHEDEV2_DATA/AAAdata/BACKUPS/crontab.log 2>&1 yes - shows in log

NEXT
2. Which one ?
* * * * * /share/CACHEDEV2_DATA/AAAdata/BACKUPS/crontab.log 2>&1 or
* * * * * date > /share/CACHEDEV2_DATA/AAAdata/BACKUPS/crontab.log 2>&1

Actually doesn't matter as bother return same message

Command "*****/ share............. failed with return code 127 and error message

And nothing in Crontab.log.

RedNoah I really do appreciate your support but should it be this difficult?
Surely some of your users are doing what I want!

Maybe I should sit back and just wait until someone says
put this line in the crontab file and restart and u now have the app run every x hours!!

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 22 Jul 2019, 07:54

2.
It should be a matter of adding a line to your cron tab. Done. However, if it for some reason doesn't just work, then there is no magic command that will make it work, because that magic command already doesn't work, which is why we are were we are.

As for testing /path/to/script.sh refers to a bash script file that you have created yourself:

Code: Select all

* * * * * /path/to/script.sh > /path/to/log 2>&1

3.
Synology NAS has a nice Scheduler app with user-friendly GUI. Feel free to ask QNAP (or any other 3rd party developer) to make a nice and user-friendly Scheduler GUI app for QNAP. Should be a common requirement. No idea why QNAP doesn't make it easy.
:idea: Please read the FAQ and How to Request Help.

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 22 Jul 2019, 08:15

So I've tried this myself, and it works out of the box.


:idea: Google Search "qnap cron" ➔ https://wiki.qnap.com/wiki/Add_items_to_crontab


Add crontab entry:

Code: Select all

echo "* 4 * * * /opt/filebot-node/task 0" >> /etc/config/crontab
:idea: Add line to cron using echo and IO redirection to crontab file (don't do this more than once, as you'll be adding task after task, edit instead using vi or nano editors).

:idea: 0 refers to the first scheduled task in FileBot Node. When you schedule a task in FileBot Node, it should show you the command you can run to run the new task.


Reload crontab:

Code: Select all

crontab /etc/config/crontab && /etc/init.d/crond.sh restart
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 22 Jul 2019, 15:11

ok
Have done that

So at 4am it should run.

that is 5 hours time
I will check in the morning

Thanks and will report back'

No luck
No message no nothing !

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 23 Jul 2019, 05:16

Find a Linux-savvy friend and have him figure it out, and then share your solution. ;)
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 23 Jul 2019, 08:17

rednoah wrote:
23 Jul 2019, 05:16
Find a Linux-savvy friend and have him figure it out, and then share your solution. ;)
Thanks Rednoah

That's why I posted here. I am hoping someone is doing what I want.
You suggest under Schedule what should work.
It appears no one is actually using the schedule which I find quite odd!

I have asked the same question on the Qnap forum - 3 days 50 views - no replies.
That is what that forum is like. Lots of lurkers that don't interact or help

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 23 Jul 2019, 10:03

I guess some of these things can only be fixed by being in front of the keyboard and trying lots of things.

It'll work out of the box for most. Worked out of the box for me. Unfortunately, I don't know why it doesn't work for you.

No idea, other than debugging things step by step as explained above.
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 25 Jul 2019, 04:21

What actually does "out of the box " mean?
I know what it means but what did u actually do??

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 25 Jul 2019, 05:14

Image

I did this:
rednoah wrote:
22 Jul 2019, 08:15
So I've tried this myself, and it works out of the box.


:idea: Google Search "qnap cron" ➔ https://wiki.qnap.com/wiki/Add_items_to_crontab


Add crontab entry:

Code: Select all

echo "* 4 * * * /opt/filebot-node/task 0" >> /etc/config/crontab
:idea: Add line to cron using echo and IO redirection to crontab file (don't do this more than once, as you'll be adding task after task, edit instead using vi or nano editors).

:idea: 0 refers to the first scheduled task in FileBot Node. When you schedule a task in FileBot Node, it should show you the command you can run to run the new task.


Reload crontab:

Code: Select all

crontab /etc/config/crontab && /etc/init.d/crond.sh restart
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 27 Jul 2019, 11:49

Have done exactly as you layed out.

Will check tomorrow and see if something happens at 4am!

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 28 Jul 2019, 07:09

Nothing shows under schedule.

I guess I should ask - do they show in the GUI at the scheduled time

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 28 Jul 2019, 08:23

It should. In the sense, that the task will write to the same log file, so it'll show when the log file is viewed via FB Node.

Note that there will not be any additional items in the task list.

* Best to include screenshots, to make sure we're on the same page.
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 29 Jul 2019, 03:40

Ok some good news and some bad news.

My "pushalot" notification showed that file bot ran at 4.am Yes!

But it did not show in the GUI. No really that bad a news.

Will now change it to run every 6 hours .

User avatar
rednoah
The Source
Posts: 16419
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Run Filebot node every 6 hours.

Post by rednoah » 29 Jul 2019, 16:36

You can see what is happening why having a look the code:

Code: Select all

cat /opt/filebot-node/task

FileBot logging is redirected here:

Code: Select all

/opt/filebot-node/data/log/0.log
:idea: 0 refers to task id 0

:idea: FileBot Node simply allows you to view this file via the web application, so anything that is written to this log file, can be seen when viewed via the web application. Since the browser caches this resource too, changes might not be immediately visible.
:idea: Please read the FAQ and How to Request Help.

spikemixture
Posts: 43
Joined: 17 Jun 2018, 13:28

Re: Run Filebot node every 6 hours.

Post by spikemixture » 30 Jul 2019, 14:35

It is now running every 6 hours but not showing in the gui under Schedule. I can live with that

Thanks for all your help.

Post Reply