Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: gavinmc42 on October 28, 2014, 04:57:26 AM

Title: Cron on Pi
Post by: gavinmc42 on October 28, 2014, 04:57:26 AM
Been looking at all the forum stuff on Cron, still cannot quite get it.

/etc/cron.d, /etc/cron.daily etc I get.

crontab -l reports the following
crontab: can't open 'tc': No such file or directory.

I want to run scripts for reading i2c sensor and emailing at certain times

Ok got it now, logged in as tc so need a file called tc formatted as crontab.
Now how do I get it to run when not logged in?

Title: Re: Cron on Pi
Post by: curaga on October 28, 2014, 05:18:27 AM
You create it with crontab -e. It runs if the cron daemon is running (cron bootcode).
Title: Re: Cron on Pi
Post by: gavinmc42 on October 28, 2014, 09:51:46 PM
Thanks,

Was looking everywhere in the file directories, forgot about bootfiles.
Better turn syslog on as well while testing.

Time to read Corebook and Intro to Linux again.

Getting closer to doing my code in scripts and eliminating the python code/lib/tcz etc

The good thing with RPi is you learn a little Linux, moving to TC from Raspbian means I am learning even more.
One step closer to Embedded  and IoT Linux.
Title: Re: Cron on Pi
Post by: gavinmc42 on November 05, 2014, 11:38:04 PM
Finally got cron working the way I want with timezone correct for my location.
crond defaults to UTC, ok for servers but not when collecting local sensor data.

Enable cron in cmdline.txt

Use crontab -l to list it, crontab -e to edit (re/learn vi, ouch).
This makes a file called tc in /var/spool/cron/crontabs

example

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/bin:/usr/sbin

*/5 * * * * TZ=EST-10 date >> /tmp/date.log

The trick is to do the TZ=??? before the script you want run.
Especially if your script uses date to time stamp sensor data collection for logging.

Tip -use top to check only one crond running, wasted time figuring that out.