Files
buttonctl/1og/service.sh
2025-09-11 15:36:04 +02:00

30 lines
471 B
Bash

#!/usr/bin/env bash
# Generate systemd service file
FILE=/etc/systemd/system/buttond.service
button=$(realpath button.py)
if [[ ! -f $button ]]; then
echo button.py not found
exit 1
fi
vpython=$(realpath venv/)/bin/python
if [[ ! -e $vpython ]]; then
echo venv not found
exit 1
fi
cat > "$FILE" << EOF
[Unit]
Description = buttonctl
[Service]
Type = simple
ExecStart = $vpython $button
[Install]
WantedBy=multi-user.target
Alias=buttond.service
EOF