I use a raspberry pi to collect temperature data from homebrewing activity and store it in both a MySQL database and a MongoDB database on my RPi. In addition, I have a bottle/python web server on the RPi.
I use a screen
for the mongod server and another screen
for the python script that collects the temperatures. The MySql server runs as a service so I don't need to use screen
for that.
This is great but whenever I have a poweroutage everything goes haywire. I just suffered my last outage a week ago and have made the following adjustments to m /etc/rc.local
file:
#Turn on Temperature sensors
sudo modprobe w1-gpio
sudo modprobe w1-therm
#Turn on MySQL Server
sudo service mysql start
#Turn on mongod
mongod
#Run python script
/home/pi/thermometer_object.py
I was told to put everything in the /etc/rc.local
file for anything I wanted to execute when the RPi boots up.
The MySQL server stars when the RPi reboots. But the mongod server does not. (Yep, mongod is in the path). The python script didn't start (presumably because the mongod isn't on). When I manually execute the python script, I'm told that the mongod isn't on. When I turn it on, I can execute the script, which tells me the mysql service started.
I don't know where to find a dump to see what happened .. all I know is that there is no mongod or python files running (ps -e | grep python
or ps -e | grep mongod
).
But this is still unsatisfactory even if it worked. I require the mongod and the python script to be in a screen
, so I can SSH in at will to check up on it (particularly because the python script continuously prints to the screen the temperature of my beer).
TLDR: Is there anyway I can activate two different screens for two operations from /etc/rc.local ?
/etc/rc.local
?