# AutoKanban Service Setup

This directory contains files to run AutoKanban as a system service that starts automatically on boot.

## Quick Setup (Raspberry Pi)

1. **Run the setup script:**

   ```bash
   cd ~/autokanban
   chmod +x setup_service.sh
   ./setup_service.sh
   ```

2. **The app will now start automatically on boot!**

## Service Management Commands

```bash
# Check if service is running
sudo systemctl status autokanban

# Stop the service
sudo systemctl stop autokanban

# Start the service
sudo systemctl start autokanban

# Restart the service
sudo systemctl restart autokanban

# View live logs
sudo journalctl -u autokanban -f

# View recent logs
sudo journalctl -u autokanban -n 50

# Disable autostart on boot
sudo systemctl disable autokanban

# Enable autostart on boot
sudo systemctl enable autokanban
```

## Manual Service Installation

If the setup script doesn't work, install manually:

```bash
# Copy service file
sudo cp autokanban.service /etc/systemd/system/

# Edit paths if needed
sudo nano /etc/systemd/system/autokanban.service

# Reload systemd
sudo systemctl daemon-reload

# Enable and start
sudo systemctl enable autokanban
sudo systemctl start autokanban
```

## Updating the App

After pulling new code:

```bash
cd ~/autokanban
git pull
sudo systemctl restart autokanban
```

## Troubleshooting

**Service won't start:**

```bash
# Check logs for errors
sudo journalctl -u autokanban -n 50

# Check Python path
which python
# Update ExecStart in service file if needed
```

**Permission issues:**

```bash
# Make sure user is in dialout group (for printer)
sudo usermod -a -G dialout $USER

# Reboot for group changes to take effect
sudo reboot
```

**Port already in use:**

```bash
# Check what's using port 8000
sudo lsof -i :8000

# Kill the process or change port in start_app.py
```
