Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Continuous or timed?

by stevieb (Canon)
on Dec 11, 2020 at 17:23 UTC ( [id://11125020]=note: print w/replies, xml ) Need Help??


in reply to Continuous or timed?

"It seems to me that 1 is not such a good plan because, if for any reason the script were to fail, the system fails and doesn't restart."

That, right there, is precisely why I recommended picking up a $3 microcontroller for the project instead.

A microcontroller does one thing, and one thing only... executes the code you write. It does nothing more. It is not have the layers upon layers of software and complexity nor the potential problems that a script has running on top of an OS does.

You've gone the Pi route, so I'll stick with that. If the system fails or doesn't restart, cron isn't going to help you, so 1 & 2 are prone to the same type of failure there. However, if the system does fail, you've got bigger problems anyway.

Unless you're willing to get into extra complexity of having a watchdog type script running to monitor the main process, I'd stick with cron, ensuring that the script that's being run verifies that it can never start more than one instance of itself, and if it makes such an attempt, fail and send out a warning message of some sort.

Replies are listed 'Best First'.
Re^2: Continuous or timed?
by Bod (Parson) on Dec 11, 2020 at 19:57 UTC

    precisely why I recommended picking up a $3 microcontroller for the project instead

    I do get that and it makes a lot of sense.
    However, I see this also as an opportunity to get a better understanding of Linux, plus I want to be able to remotely update the times for closing and opening without having to visit. For future reference, would a microcontroller be able to call out to a web server and retrieve an updated settings file?

    Just from setting up the RPi my knowledge has improved so, on one level this project is a success already 😊

      "For future reference, would a microcontroller be able to call out to a web server and retrieve an updated settings file?"

      100% yes. In fact, in my indoor grow automation system, I have a microcontroller for each grow tent, and all of them reach out to a central system over HTTPS and retrieve their configuration from there (with a fallback default config if the server can't be reached). I don't pull a file however, the system returns back a JSON string which I parse as the config.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11125020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 04:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found