added service for linux
This commit is contained in:
parent
f4a8e05b90
commit
2ebfc20537
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
|
fwledmonitor.service
|
||||||
|
21
install_as_service.sh
Normal file
21
install_as_service.sh
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
chmod +x run.sh
|
||||||
|
rm -f fwledmonitor.service || true
|
||||||
|
cat <<EOF >>./fwledmonitor.service
|
||||||
|
[Unit]
|
||||||
|
Description=Framework 16 LED System Monitor
|
||||||
|
After=network.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
WorkingDirectory=$PWD
|
||||||
|
ExecStart=sh -c "'$PWD/run.sh'"
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo systemctl stop fwledmonitor
|
||||||
|
sudo cp fwledmonitor.service /lib/systemd/system
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable fwledmonitor
|
@ -78,9 +78,13 @@ if __name__ == "__main__":
|
|||||||
draw_bar(grid, last_network_download, foreground_value, bar_x_offset=5, draw_at_bottom=True) # Download
|
draw_bar(grid, last_network_download, foreground_value, bar_x_offset=5, draw_at_bottom=True) # Download
|
||||||
draw_borders_right(grid, background_value)
|
draw_borders_right(grid, background_value)
|
||||||
right_drawing_queue.put(grid)
|
right_drawing_queue.put(grid)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import traceback
|
import traceback
|
||||||
print(f"Error in main loop: {e}")
|
print(f"Error in main loop: {e}")
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
time.sleep(1.0)
|
time.sleep(1.0)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
print("Exiting")
|
Loading…
Reference in New Issue
Block a user