[ Cron_okm ] Time-based job scheduler

Discussion on apps, protocols, APIs, specifications, and more. You are welcome to join us as a TOS app developer!
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

[ Cron_okm ] Time-based job scheduler

Post by outkastm »

Image

About : https://github.com/cronie-crond/cronie

Applicable models: x.64 series, ARMv8 series
Applicable TOS4: 4.1.27 or later versions
Applicable TOS5: 5.1.17 or later versions
App download: https://tmnascommunity.eu/download/cron_okm/

Module WebUI for additional settings can be accesses at

TOS4: http(s)://yournasip:port/modules/Cron_okm/www
TOS5: click on Support & Help from app description inside the App Center

How to manully install this app on TerraMaster application store?

About

This module implements a CRON daemon for use by administrators and other modules to periodically run jobs on the NAS. To simplify job management and to be more flexible this module uses a combination of CRON and Anacron to provide different ways to inject jobs.

Cron is a time-based job scheduler in Unix-like computer operating systems. Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes

Image
User avatar
titanrx8
Posts: 222
Joined: 17 Jul 2020, 06:17

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by titanrx8 »

I have 2 x f2-221. One is only the destination for rsync so only needs to power on when rsync is scheduled to run. The problem I have is that the destination Nas scheduled power on and off doesn't work correctly since update to 4.2.14. could I create a cron job on the primary server to issue a wake on lan command to the rsync server and then after a set time issue a shut down command to the rsync server?
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by outkastm »

Sure you can. Cronjob can be used to schedule any command/script you want.

For wake on lan, use the command

Code: Select all

[root@TNAS ~]# ether-wake MAC

BusyBox v1.27.2 (2018-04-03 18:05:42 CST) multi-call binary.

Usage: ether-wake [-b] [-i IFACE] [-p aa:bb:cc:dd[:ee:ff]/a.b.c.d] MAC

Send a magic packet to wake up sleeping machines.
MAC must be a station address (00:11:22:33:44:55) or
a hostname with a known 'ethers' entry.

        -b              Broadcast the packet
        -i IFACE        Interface to use (default eth0)
        -p PASSWORD     Append four or six byte PASSWORD to the packet

You can use this guide and adapt it to your needs and commands available on NAS

https://www.cyberciti.biz/faq/how-to-wa ... -in-linux/
User avatar
nhenry96
Posts: 3
Joined: 13 Aug 2021, 07:01

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by nhenry96 »

Hi
I've installed the app and shows up on the desktop but when I open the app or go to the URL (~/modules/Cron_okm/www) I just get: "(no access)"

I was logged in with my only user and that is an admin of course, I've tried rebooting and reinstalling but I'm just seeing (no access).

I'm running TOS 4.2.14

Any help would be appreciated.

Cheers
Nick
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by outkastm »

download again the package and install it
sports_wook
Posts: 74
Joined: 04 Feb 2020, 05:00

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by sports_wook »

Downloaded the new package and working properly now - thanks!
User avatar
nhenry96
Posts: 3
Joined: 13 Aug 2021, 07:01

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by nhenry96 »

outkastm wrote: 14 Aug 2021, 00:54 download again the package and install it
Great thanks outkastm, that got it
User avatar
alvingo
Posts: 3
Joined: 30 Dec 2021, 11:58

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by alvingo »

Just want to verify if I want to put this line in there, will it work?

Code: Select all

0 0 * * * * root find ./mnt/md1/Temp -mtime +20 -type f -delete
The command above is to find files older than 20 days and delete it.

Where does this conf file be saved when you apply it.

Sorry for the n00b questions.
User avatar
Hardfecx
Posts: 244
Joined: 04 Jun 2020, 23:17

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by Hardfecx »

is there a possibility to get an arm version?
User avatar
outkastm
Posts: 1185
Joined: 29 Dec 2020, 23:52

Re: [ Cron_okm ][ 1.5.7.0 ] Time-based job scheduler

Post by outkastm »

alvingo wrote: 31 Dec 2021, 14:33 Just want to verify if I want to put this line in there, will it work?

Code: Select all

0 0 * * * * root find ./mnt/md1/Temp -mtime +20 -type f -delete
The command above is to find files older than 20 days and delete it.

Where does this conf file be saved when you apply it.

Sorry for the n00b questions.
if you edit the file via WebUI, it is saved in the general config located at /usr/local/Cron_okm/sys/etc/cron.d/0module

The logs can be viewed in the messages file located at /var/log/messages and look for the lines with OKM_CROND

Code: Select all

Jan  2 20:40:01 TNAS-xxxx OKM_CROND[16252]: (www-data) CMD (/usr/local/bin/Nextcloud_okm cron.php)
Jan  2 20:40:06 TNAS-xxxx OKM_CROND[16251]: (www-data) CMDEND (/usr/local/bin/Nextcloud_okm cron.php)
Post Reply