Files
battery-tracker-app/sbin
iterminate 6ea3eae981 Initial commit: Flask battery tracker app
- Flask + SQLAlchemy (MariaDB-compatible schema) battery tracking web app
- 40 pre-seeded batteries (Eneloop, BONAI, Energizer NiMH) across 5 devices
- Business rules: block retired assignment, brand-mix warnings, capacity checks
- Mobile-friendly Jinja2 templates with inline CSS
- waitress WSGI server via systemd user service (sbin/install-service.sh)
- SQLite → MariaDB migration script (migrate_to_mariadb.py)
- 26 passing acceptance tests (pytest + Flask test client)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 22:38:16 -05:00
..

sbin — Support Scripts

install-service.sh

Generates a systemd user-level service file and enables it. No root required.

Prerequisites: The app's .venv must exist and have Flask installed.

bash sbin/install-service.sh

You will be prompted for a host (default 127.0.0.1) and port (default 5000). The script writes ~/.config/systemd/user/battery-tracker.service and enables it.

Start the service:

systemctl --user start battery-tracker
systemctl --user status battery-tracker

View live logs:

journalctl --user -u battery-tracker -f

Make it start on login (requires lingering to be enabled for your user):

loginctl enable-linger "$USER"

Uninstall:

systemctl --user disable --now battery-tracker
rm ~/.config/systemd/user/battery-tracker.service
systemctl --user daemon-reload

Re-run to update (e.g. if you moved the app directory):

bash sbin/install-service.sh
systemctl --user restart battery-tracker