Hi folks, Does anyone know how to instruct cron to carry out a command when a connection to the internet is first made after boot? I have a few jobs that only need to be done once per day and require an internet connection e.g downloading the weather forecast and my rss feeds. I’m not always connected to the internet on boot and do not have the computer switched on at the same times every day. Many thanks for any suggestions.

  • taladar@sh.itjust.works
    link
    fedilink
    arrow-up
    5
    ·
    9 months ago

    Instead of having it sleep 10 minutes just make it a cronjob that runs every 10 minutes and has a lockfile, much more robust that way.

      • taladar@sh.itjust.works
        link
        fedilink
        arrow-up
        2
        ·
        9 months ago

        If it should be done only twice a day sleeping for 12h would be even more error prone and you would be even less likely to have it actually run at that time.

        Also, if it should be done only twice a day you don’t really want it to run twice a day only since you can not guarrantee that you have internet exactly at the time when your timer expires, you would want to check some “last_updated” timestamp and check if it was more than 12h ago.