Page 1 of 2

Run Filebot node every 6 hours.

Posted: 20 Jul 2019, 13:43
by spikemixture

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 ?

Re: Run Filebot node every 6 hours.

Posted: 20 Jul 2019, 13:57
by rednoah
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

Re: Run Filebot node every 6 hours.

Posted: 21 Jul 2019, 03:02
by spikemixture
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 ?

Re: Run Filebot node every 6 hours.

Posted: 21 Jul 2019, 04:50
by rednoah
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

Re: Run Filebot node every 6 hours.

Posted: 21 Jul 2019, 08:39
by spikemixture
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?

Re: Run Filebot node every 6 hours.

Posted: 21 Jul 2019, 08:53
by rednoah
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

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 04:21
by spikemixture
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

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 04:43
by rednoah
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

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 04:48
by rednoah
: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!

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 07:07
by spikemixture
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!!

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 07:54
by rednoah
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.

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 08:15
by rednoah
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

Re: Run Filebot node every 6 hours.

Posted: 22 Jul 2019, 15:11
by spikemixture
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 !

Re: Run Filebot node every 6 hours.

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

Re: Run Filebot node every 6 hours.

Posted: 23 Jul 2019, 08:17
by spikemixture
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

Re: Run Filebot node every 6 hours.

Posted: 23 Jul 2019, 10:03
by rednoah
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.

Re: Run Filebot node every 6 hours.

Posted: 25 Jul 2019, 04:21
by spikemixture
What actually does "out of the box " mean?
I know what it means but what did u actually do??

Re: Run Filebot node every 6 hours.

Posted: 25 Jul 2019, 05:14
by rednoah
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

Re: Run Filebot node every 6 hours.

Posted: 27 Jul 2019, 11:49
by spikemixture
Have done exactly as you layed out.

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

Re: Run Filebot node every 6 hours.

Posted: 28 Jul 2019, 07:09
by spikemixture
Nothing shows under schedule.

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

Re: Run Filebot node every 6 hours.

Posted: 28 Jul 2019, 08:23
by rednoah
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.

Re: Run Filebot node every 6 hours.

Posted: 29 Jul 2019, 03:40
by spikemixture
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 .

Re: Run Filebot node every 6 hours.

Posted: 29 Jul 2019, 16:36
by rednoah
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.

Re: Run Filebot node every 6 hours.

Posted: 30 Jul 2019, 14:35
by spikemixture
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.

Re: Run Filebot node every 6 hours.

Posted: 26 Nov 2022, 12:15
by spikemixture
I am back to see if anyone has had success running crontab script every 4 or 6 hours.

The schedule shows in my filebot node in Qnap NAS and runs when I click the schedule.

This is the line in crontab that does not run every 4 hours .

Is "task 1 " correct

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