commit cdcf1e6de0b0e47855c2b36476a145371bad5d64
parent fcbc41d9f3098929815fcf0445138a4d1f2f73cd
Author: rob <rob@tarina.org>
Date: Fri, 26 Aug 2022 15:09:40 +0300
oh yes
Diffstat:
2 files changed, 13 insertions(+), 21 deletions(-)
diff --git a/install.sh b/install.sh
@@ -2,27 +2,12 @@
echo "run with sudo ./install.sh"
-installfolder=" $(pwd)"
+installfolder="$(pwd)"
echo "$installfolder"
+user="$(whoami)"
+echo "$user"
-cat <<EOF > /etc/systemd/system/rastabrew.service
-[Unit]
-Description=rastabrew
-After=multi-user.target
-
-[Service]
-Type=simple
-ExecStart=$installfolder/startgivarna.sh
-User=pi
-Restart=always
-RestartSec=3
-StandardInput=tty-force
-TTYPath=/dev/tty1
-
-[Install]
-WantedBy=multi-user.target
-EOF
-systemctl enable rastabrew
+systemctl disable ride_on
systemctl daemon-reload
cat <<EOF > /etc/systemd/system/ride_on.service
@@ -33,14 +18,15 @@ After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 $installfolder/ride_on.py
-User=pi
+User=$user
Restart=always
RestartSec=3
StandardInput=tty-force
-TTYPath=/dev/tty1
[Install]
WantedBy=multi-user.target
EOF
systemctl enable ride_on
systemctl daemon-reload
+
+systemctl restart ride_on
diff --git a/ride_on.py b/ride_on.py
@@ -17,6 +17,12 @@ db_local = basedir+'rastabrew.db'
db = web.database(dbn='sqlite', db=db_local)
db2 = web.database(dbn=config.dbn, host=config.host, user=config.user, port=config.port, db=config.db, pw=config.pw)
+os.system('pkill -9 brew1')
+os.system('pkill -9 brew2')
+time.sleep(1)
+os.system(basedir + 'brew1 &')
+os.system(basedir + 'brew2 &')
+
term = Terminal()
with Onewire('u') as o: