diff --git a/README.md b/README.md index f6e298e..5193e21 100644 --- a/README.md +++ b/README.md @@ -69,8 +69,28 @@ git submodule init git sumodule update ``` + +### clients + +``` +apt install supervisor +``` + +Add the following to the first section of `/etc/supervisor/supervisord.conf` + +``` +chown=pi:pi +``` + + ## Deploy / usefull commands ```bash for i in {1..6}; do rsync -av ~/hugvey/ pi@hugvey$i.local:/home/pi/hugvey/ --exclude=www --exclude=venv --exclude=local --exclude=*.pyc --exclude=.git; done ``` + +```bash +for i in {1..6}; do ssh pi@hugvey$i.local "sudo shutdown -h now"; done +``` + + diff --git a/install_server.sh b/install_server.sh new file mode 100644 index 0000000..57b7c69 --- /dev/null +++ b/install_server.sh @@ -0,0 +1,16 @@ +sudo apt install munin-node +sudo cp installation/rpi-internal-temp /usr/share/munin/plugins +sudo ln -sf /usr/share/munin/plugins/rpi-internal-temp /etc/munin/plugins/rpi-internal-temp +sudo chmod a+x /usr/share/munin/plugins/rpi-internal-temp +sudo echo "allow ^192\\.168\\.0\\.155\$" >> /etc/munin/munin-node.conf +sudo service munin-node restart + +sudo apt install supervisor + +# Added chown=pi:pi +sudo cp installation/supervisord.conf /etc/supervisor/supervisord.conf +sudo ln -s /home/pi/hugvey/supervisor.conf /etc/supervisor/conf.d/hugvey.conf +sudo service supervisord restart +sudo supervisorctl reread +sudo supervisorctl update + diff --git a/installation/rpi-internal-temp b/installation/rpi-internal-temp new file mode 100644 index 0000000..f727541 --- /dev/null +++ b/installation/rpi-internal-temp @@ -0,0 +1,22 @@ +#!/bin/bash +# A basic munin-node script to monitor the Raspberry Pi temperature + +if [ "$1" == "autoconf" ]; then + if [ -e /sys/class/thermal/thermal_zone0/temp ]; then + echo "yes" + else + echo "no" + exit 1 + fi +elif [ "$1" == "config" ]; then + echo "graph_title Raspberry Pi Temperature" + echo "graph_vlabel Temperature in Celsius" + echo "graph_category Sensors" + echo "temp.warning 60" + echo "temp.critical 80" + echo "temp.label CPU" +else + temp=$(cat /sys/class/thermal/thermal_zone0/temp) + awk "BEGIN { print \"temp.value \" $temp/1000 }" +fi + diff --git a/installation/supervisord.conf b/installation/supervisord.conf new file mode 100644 index 0000000..02938d1 --- /dev/null +++ b/installation/supervisord.conf @@ -0,0 +1,30 @@ +; supervisor config file + +[unix_http_server] +file=/var/run/supervisor.sock ; (the path to the socket file) +chmod=0700 ; sockef file mode (default 0700) +chown=pi:pi + +[supervisord] +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket + +; The [include] section can just contain the "files" setting. This +; setting can list multiple files (separated by whitespace or +; newlines). It can also contain wildcards. The filenames are +; interpreted as relative to this file. Included files *cannot* +; include files themselves. + +[include] +files = /etc/supervisor/conf.d/*.conf +