From acbf1682186a417684a35b16145b00e9926a62d7 Mon Sep 17 00:00:00 2001 From: sebseb7 Date: Thu, 25 Dec 2025 02:34:28 +0100 Subject: [PATCH] u --- agents/tapo/build-all.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/agents/tapo/build-all.sh b/agents/tapo/build-all.sh index 1882c92..6fe293e 100755 --- a/agents/tapo/build-all.sh +++ b/agents/tapo/build-all.sh @@ -181,3 +181,43 @@ echo -e " ${YELLOW}curl https://bashupload.com -F=@dist/tapo-countdown-pi3_pi4_ echo "" echo "Then on Pi, download and run:" echo -e " ${YELLOW}curl -sSL https://bashupload.com/XXXXX -o tapo-agent && chmod +x tapo-agent${NC}" + +echo "" +echo -e "${BLUE}==========================================" +echo "Installing as User Service (no sudo needed)" +echo -e "==========================================${NC}" +echo "" +echo "1. Setup binary and config:" +echo -e " ${YELLOW}chmod +x ~/tapo-agent${NC}" +echo -e " ${YELLOW}mkdir -p ~/.config/tapo${NC}" +echo -e " ${YELLOW}cp /path/to/config.toml ~/.config/tapo/config.toml${NC}" +echo "" +echo "2. Create service file:" +echo -e " ${YELLOW}mkdir -p ~/.config/systemd/user${NC}" +echo -e " ${YELLOW}cat > ~/.config/systemd/user/tapo-agent.service << 'EOF'" +echo "[Unit]" +echo "Description=Tapo Smart Plug Agent" +echo "After=network-online.target" +echo "" +echo "[Service]" +echo "Type=simple" +echo "ExecStart=%h/tapo-agent --config %h/.config/tapo/config.toml" +echo "Restart=always" +echo "RestartSec=10" +echo "" +echo "[Install]" +echo "WantedBy=default.target" +echo -e "EOF${NC}" +echo "" +echo "3. Enable and start service:" +echo -e " ${YELLOW}systemctl --user daemon-reload${NC}" +echo -e " ${YELLOW}systemctl --user enable tapo-agent${NC}" +echo -e " ${YELLOW}systemctl --user start tapo-agent${NC}" +echo "" +echo "4. Enable linger (service runs at boot, before login):" +echo -e " ${YELLOW}loginctl enable-linger \$USER${NC}" +echo "" +echo "5. Manage service:" +echo -e " ${YELLOW}systemctl --user status tapo-agent${NC} # Check status" +echo -e " ${YELLOW}systemctl --user restart tapo-agent${NC} # Restart" +echo -e " ${YELLOW}journalctl --user -u tapo-agent -f${NC} # View logs"