Quantcast
Channel: SmallNetBuilder Forums
Viewing all articles
Browse latest Browse all 6885

Creating a crontab task that runs hourly - help

$
0
0
Hi I have installed flexget on my RT-N66U using this generic openwrt guide:
http://flexget.com/wiki/InstallWizard/OpenWrt

It all runs perfectly when I run it manually but I want to set it up to run every hour using crontab. Ive read the readme file RMerlin created for crond on asuswrt:
https://github.com/RMerl/asuswrt-mer...DME-merlin.txt
Quote:

* Crond *
Crond will automatically start at boot time. You can
put your cron tasks in /var/spool/cron/crontabs/ . The file
must be named "admin" as this is the name of the system user.
Note that this location resides in RAM, so you would have to
put your cron script somewhere such as in the jffs partition,
and at boot time copy it to /var/spool/cron/crontabs/ using
an init-start user script.

A simple way to manage your cron jobs is through the
included "cru" command. Just run "cru" to see the
usage information. You can then put your "cru"
commands inside a user script to re-generate your cron jobs
at boot time.
And have come up with a script:

Create init-start file
Code:

nano -w /jffs/scripts/init-start
Command inside init-start file to copy cron job file from jffs to ram
Code:

#!/bin/sh
cp /jffs/scripts/ADMIN_USERNAME /var/spool/cron/crontabs/ADMIN_USERNAME

Save/exit nano then make init-start executable
Code:

chmod a+rx /jffs/scripts/init-start

Creating cron job file
Code:

nano -w /jffs/scripts/ADMIN_USERNAME
Command inside cron job file
Code:

@hourly /opt/bin/flexget --cron
Save exit nano

Will this work? - Im very new to linux and this is my first time deviating from a guide :eek:
Do I need to do anything to the cronjob file once its in the ram to get it to run?

Viewing all articles
Browse latest Browse all 6885

Trending Articles