first commit
This commit is contained in:
29
root/etc/cont-init.d/10-setup
Executable file
29
root/etc/cont-init.d/10-setup
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
MQTT_BROKER="${MQTT_BROKER:-192.168.100}";
|
||||
USERNAME="${USERNAME:-mosquitto}";
|
||||
PASSWORD="${PASSWORD:-insecurebydefault}";
|
||||
PROXMOX_NAME="${PROXMOX_NAME:-pve}";
|
||||
|
||||
TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
|
||||
|
||||
[[ ! -f /mosquitto/config/temp2mqtt ]] && touch /mosquitto/config/temp2mqtt;
|
||||
cat <<EOF >> /mosquitto/config/temp2mqtt
|
||||
#!/bin/bash
|
||||
# ___ _ _ _ __
|
||||
# / __|| |_ | |_ ___ | '_ \ ___
|
||||
# \__ \| _|| \ / _ \| .__// -_)
|
||||
# |___/ \__||_||_|\___/|_| \___|
|
||||
|
||||
MQTT_BROKER="${MQTT_BROKER:-192.168.100}";
|
||||
USERNAME="${USERNAME:-mosquitto}";
|
||||
PASSWORD="${PASSWORD:-insecurebydefault}";
|
||||
PROXMOX_NAME="${PROXMOX_NAME:-pve}";
|
||||
|
||||
TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g');
|
||||
|
||||
mosquitto_pub -h "${MQTT_BROKER}" -u "${USERNAME}" -P "${PASSWORD}" -t proxmox/"${PROXMOX_NAME}"/cpu_temp -m "${TEMP}"
|
||||
EOF
|
||||
|
||||
chown -R mosquitto:mosquitto /mosquitto/;
|
||||
chmod +x /mosquitto/config/temp2mqtt;
|
Reference in New Issue
Block a user