User Tools

Site Tools


arduinohouse

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
arduinohouse [2023/05/17 07:16]
admin
arduinohouse [2023/05/17 09:28] (current)
admin
Line 1: Line 1:
 +
 + you need the process that monitors your process to be the process' parent. What does this mean? It means only the process that starts your process can reliably wait for it to end. In bash, this is absolutely trivial.
 +
 +until myserver; do
 +    echo "Server 'myserver' crashed with exit code $?.  Respawning.." >&2
 +    sleep 1
 +done
 +
 +The above piece of bash code runs myserver in an until loop. The first line starts myserver and waits for it to end. When it ends, until checks its exit status. If the exit status is 0, it means it ended gracefully (which means you asked it to shut down somehow, and it did so successfully). In that case we don't want to restart it (we just asked it to shut down!). If the exit status is not 0, until will run the loop body, which emits an error message on STDERR and restarts the loop (back to line 1) after 1 second.
 +
 +Why do we wait a second? Because if something's wrong with the startup sequence of myserver and it crashes immediately, you'll have a very intensive loop of constant restarting and crashing on your hands. The sleep 1 takes away the strain from that.
 +
 +Now all you need to do is start this bash script (asynchronously, probably), and it will monitor myserver and restart it as necessary. If you want to start the monitor on boot (making the server "survive" reboots), you can schedule it in your user's cron(1) with an @reboot rule. Open your cron rules with crontab:
 +
 +crontab -e
 +
 +Then add a rule to start your monitor script:
 +
 +@reboot /usr/local/bin/myservermonitor
 +
 +Alternatively; look at inittab(5) and /etc/inittab. You can add a line in there to have myserver start at a certain init level and be respawned automatically.
 +
 +-----------------------------------------------------------------------------------------
 +
 +https://forum.arduino.cc/t/433mhz-using-radiohead-constructor-argument-to-change-rx-tx-pins/1077731 radiohead tx pin
 +
 +https://startingelectronics.org/tutorials/arduino/digispark/digispark-windows-setup/  digispark setup
 +
 +https://www.instructables.com/Receiving-and-sending-data-between-Attiny85/  attiny setup
 +
 +https://github.com/adidax/dht11   dht11 library download
 +
 +https://www.makerguides.com/dht11-dht22-arduino-tutorial/ humidity sensor on attiny
 +
 +https://www.circuitbasics.com/how-to-set-up-the-dht11-humidity-sensor-on-an-arduino/  humidity sensor on attiny
 +
 +https://triq.org/rtl_433/STARTING.html    rtl433 getting started
 +
 +https://nodered.org/docs/user-guide/editor/workspace/import-export   exporting nodered flows
 +
 +------------------------------------------------------------------------------------------------------
 +
 +https://lastminuteengineers.com/433mhz-rf-wireless-arduino-tutorial/    arduino 433 transmitters and receivers
 +
 +https://forum.arduino.cc/t/sending-arrays-with-manchester-h-and-rf433/257585   manchester.h  arrays
 +
 +
 +
 +https://reference.arduino.cc/reference/en/language/variables/data-types/array/   arduino array reference
 +
 +  int myInts[6];
 +  int myPins[] = {2, 4, 8, 3, 6};
 +  int mySensVals[5] = {2, 4, -8, 3, 2};
 +  char message[6] = "hello";
 +  
 +--------------------------------------------------------------------
 +
 +https://stackoverflow.com/questions/16041191/filling-array-in-c-by-using-functions
 +
 +Arrays filling
 +------------------------------------------------------------------------------------------
 +
 +
 +
 +https://triq.org/rtl_433/OPERATION.html
 +
 +https://www.airspayce.com/mikem/arduino/RadioHead/ask_transmitter_8pde-example.html  radiohead ASK transmitter
 +
 +https://randomnerdtutorials.com/rf-433mhz-transmitter-receiver-module-with-arduino/  arduino receive/transmit
 +
 +https://github.com/merbanan/rtl_433  rtl433 download
 +
 +https://tech.sid3windr.be/2017/03/getting-your-currentcost-433mhz-data-into-openhab-using-an-rtl-sdr-dongle-and-mqtt/
 +    currentcost and mqtt rtl433
 +    
 +    
 +
 +---------------------------------------------------------------------------------------------------------------
 https://forum.arduino.cc/t/arduino-433-mhz-rf-sending-numbers-instead-of-strings/619707/4 https://forum.arduino.cc/t/arduino-433-mhz-rf-sending-numbers-instead-of-strings/619707/4
 Looking at the loop() in the ask_transmitter example Looking at the loop() in the ask_transmitter example
arduinohouse.1684307819.txt.gz ยท Last modified: 2023/05/17 07:16 by admin