Compare commits
2 Commits
main
...
entertaiment
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e1c06a63e | |||
| 5244c21ba3 |
@@ -0,0 +1,7 @@
|
||||
#This pos-entertaiment bin for configure enable or disable entertaiments elements such enable/disable weather, gold ...so on
|
||||
# and check flags to choose wich entertaiments to run or not
|
||||
set -euo pipefail
|
||||
|
||||
CONFIG_DIR="$HOME/.config/linux_post_install"
|
||||
CONFIG_FILE="$CONFIG_DIR/entertaiment.env"
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
DATA=$(curl -s "https://api.coingecko.com/api/v3/simple/price?ids=pax-gold&vs_currencies=usd")
|
||||
|
||||
if [ -z "$DATA" ]; then
|
||||
echo "Gold API unavailable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PRICE=$(echo "$DATA" | grep -o '"usd":[0-9.]*' | cut -d: -f2)
|
||||
|
||||
if [ -z "$PRICE" ]; then
|
||||
echo "Parse error"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GRAM=$(echo "scale=2; $PRICE / 31.1035" | bc)
|
||||
|
||||
MESSAGE="🪙 Gold Price
|
||||
|
||||
1 oz: $PRICE USD
|
||||
1 gram: $GRAM USD"
|
||||
|
||||
echo "$MESSAGE"
|
||||
|
||||
pos communication telegram --send "$MESSAGE"
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
# meed to be dynamic later
|
||||
LAT="52.3676"
|
||||
LON="4.9041"
|
||||
|
||||
DATA=$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=$LAT&longitude=$LON¤t_weather=true")
|
||||
|
||||
TEMP=$(echo "$DATA" | grep -o '"temperature":[^,]*' | cut -d: -f2)
|
||||
WIND=$(echo "$DATA" | grep -o '"windspeed":[^,]*' | cut -d: -f2)
|
||||
|
||||
MESSAGE="🌤 Weather
|
||||
Temperature: ${TEMP}°C
|
||||
Wind: ${WIND} km/h"
|
||||
|
||||
echo "$MESSAGE"
|
||||
|
||||
pos communication telegram --send "$MESSAGE"
|
||||
+1
-1
@@ -26,7 +26,7 @@ while [[ $# -gt 0 ]]; do
|
||||
done
|
||||
|
||||
PACKAGES=(
|
||||
git curl wget vim nano tmux tree jq
|
||||
git curl wget bc vim nano tmux tree jq
|
||||
unzip zip rsync htop btop telnet
|
||||
net-tools iputils-ping traceroute tcpdump nmap
|
||||
openssh-client openssh-server ufw fail2ban
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=POS Entertainment Runner
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/pos-entertainment --run
|
||||
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Run POS Entertainment Hourly
|
||||
|
||||
[Timer]
|
||||
OnBootSec=5min
|
||||
OnUnitActiveSec=1h
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user