WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to get crond to wait for NTP  (Read 1748 times)

Offline lnrobby

  • Newbie
  • *
  • Posts: 3
How to get crond to wait for NTP
« on: July 18, 2018, 05:58:38 AM »
I am new to tinycore (and linux) so this question may be simple and I just haven't found it on google.

I am using bootlocal.sh to start crond. Is there any way to wait for a good system time before it starts up?

Presently I have a sleep 30 after starting up wifi which works fine but seems a bit hit and miss.

Thanks

Len

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: How to get crond to wait for NTP
« Reply #1 on: July 18, 2018, 03:17:03 PM »
hi lnrobby,

To start cron I think you should use the "cron" bootcode then /etc/init.d/tc-config handles the startup of cron at the right time.

regards
Greg

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10970
Re: How to get crond to wait for NTP
« Reply #2 on: July 19, 2018, 01:31:57 AM »
Look in settime.sh, there's a loop that waits until the time is not older than 2015.
The only barriers that can stop you are the ones you create yourself.

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: How to get crond to wait for NTP
« Reply #3 on: July 19, 2018, 04:29:23 AM »
I have a shell script loop that checks for the IP address at the start.
Most of mine run behind a firewall so they needed the ip address for the local NTP server too.

There are two main files that are useful for putting these in.
bootlocal.sh and bootstart.sh if I remember right?

Offline lnrobby

  • Newbie
  • *
  • Posts: 3
Re: How to get crond to wait for NTP
« Reply #4 on: July 21, 2018, 01:26:46 AM »
Got it working by using the boot code for cron.

I did have some trouble locating information on how to do this at first, and found it is dependant on the particular PI you are using.

I found this article.
/https://iotbytes.wordpress.com/change-picore-boot-codes-boot-options/

Thanks for the help

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: How to get crond to wait for NTP
« Reply #5 on: July 21, 2018, 09:28:49 AM »

and found it is dependant on the particular PI you are using.
 

Can you explain what do you mean?
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: How to get crond to wait for NTP
« Reply #6 on: July 21, 2018, 05:48:28 PM »
hi bmarkus,

Quote from linked article:

Quote
You can edit the “cmdline” file based on your Raspberry Pi Model and change the Boot Codes as per your requirements. For me, the file name is “cmdline3.txt” (as I am using Raspberry Pi 3), so I will use the following command to change Boot Codes

regards
Greg