How to run a script when octopi on?

i would like to run a script whenever Octoprint is on or connected to the printer.
i thought this would work but it does not!

what are my options?

I tried this as well but it did not work

i tried cron job too via these commands from a website but did not work as well:
crontab -e
choose nano, if first time

@reboot sh /home/pi/

exit and save

sudo nano
paste in:
python -m pi_mqtt_gpio.server config.yml

exit and save

sudo chmod a+x /home/pi/
sudo chmod a+x /home/pi/config.yml

off course if i run manually in Putty, it works:
python -m pi_mqtt_gpio.server config.yml

As a start use the absolute path to your yml file.

you are right! updated in Event of Octoprint. no need for cron nor plugin. thanks!


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.