njbbaer / unicorn-remote

Control your Unicorn HAT LED matrix from the web
MIT License
38 stars 6 forks source link

[Feature request] Program to autostart when Unicorn Remote is started #10

Closed Griefed closed 5 years ago

Griefed commented 5 years ago

Title.

It would be awesome if we could set a program to automatically be started after Unicorn Remote is started. CPU Utilization, for example. You boot up Unicorn Remote and CPU Utilization is started automatically. Maybe have a folder called "autostart" in which you copy/paste the program you want to start after the remote has been started.

Thank you for your time. Cheers, Griefed

1oly commented 5 years ago

An easy way around is through crontab. Not specifically what you're asking for but works ok. Adding the line @reboot . ./run.sh to crontab

with the run.sh script along the lines of

#!/bin/bash
cd unicorn-remote/
sudo pipenv run python run.py
curl -X PUT localhost:5000/api/program/demo

should start the application on reboot and send a PUT request to start the demo.

Also thanks to @njbbaer for making this repo 👍

Griefed commented 5 years ago

Thank you very much for the curl suggestion, that works like a charm. I've put the matrix program on autostart with:

curl -d "brightness=0.1&rotation=180" -X PUT localhost:5000/api/program/matrix