This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Wilma456's profile picture

cron - Runs programs automatic

Started by Wilma456, 29 December 2016 - 03:35 PM
Wilma456 #1
Posted 29 December 2016 - 04:35 PM
This Programms run a programm automatic at a custom time. Just edit /etc/crontab. e.g for /etc/crontab

#Run ls every day at 7
7 * ls
#Run dj every hour  at day 10
* 10 dj
#Run wget at day 6 at 8 o clock
8 6 wget example.com example
Something like */2 or 2,4 are not possible at the moment

Install cron with Packman

packman fetch install cron
Edited on 16 March 2017 - 04:30 PM
Wilma456 #2
Posted 01 January 2017 - 05:37 PM
Updatet to Version 1.1
Now you can put files in /etc/cron.daily to run it every day and in /etc/cron.hourly to run it every hour
Tobias SN #3
Posted 13 March 2017 - 09:01 AM
So, why do I have to enter gj to run dj?
Wilma456 #4
Posted 16 March 2017 - 05:31 PM
So, why do I have to enter gj to run dj?
Sorry typo
Dave-ee Jones #5
Posted 17 March 2017 - 03:05 AM
So does this run on startup or does it legitimately run a command every so often (whatever the rate you set it at) via alarms or something, with the main program running in the background as a coroutine checking for alarm events?

Could be interesting creating something like this as a feature of djOS, running programs every so often, kinda like Windows' task scheduler.
Wilma456 #6
Posted 17 March 2017 - 05:26 PM
So does this run on startup or does it legitimately run a command every so often (whatever the rate you set it at) via alarms or something, with the main program running in the background as a coroutine checking for alarm events?

Could be interesting creating something like this as a feature of djOS, running programs every so often, kinda like Windows' task scheduler.
cron is not running automaticly in the the background. You have to do this by hand. e.g. with bg cron or adding this lines to startup

local function cron()
shell.run("cron")
end
local function shellrun()
shell.run("shell")
end
parallel.waitForAny(cron,shellrun)
It's something like task scheduler and run a command as the times you say e.g. every hour, ever day, on day 6 at 2 o clock, every day at 5 o clock or every hour at day 7.
The programm is licensed under BSD 2-Clause, so you can use it in your OS.