I want to have a python script that will automatically run on boot of my linux machine. However, it is very important that I can see the terminal output since it uses computer vision and displays certain calculations. Is it possible for it to be displayed as if I just opened a terminal and ran the script manually? Thank you!
-
1This is more of a Linux question than a programming question, and is probably better suited for Unix & Linux SE or SuperUser. Though be sure to check their question guidelines before posting.Brian61354270– Brian613542702021-12-15 22:17:15 +00:00Commented Dec 15, 2021 at 22:17
-
Perhaps this could help? stackoverflow.com/questions/24518522/…Party-with-Programming– Party-with-Programming2021-12-15 22:18:21 +00:00Commented Dec 15, 2021 at 22:18
-
@Brian Wanting to know how to run a program at boot is both a programming and an operating system question. It'd be on topic on Unix & Linux, but it's also on topic here.John Kugelman– John Kugelman2021-12-15 23:52:15 +00:00Commented Dec 15, 2021 at 23:52
1 Answer
If your linux system uses Systemd then it has that functionality build-in. Just create a new myapp.service unit (see man systemd.service) which starts the application, enable it (so it runs on boot) and the output will go to the journal. (available with journalctl -u myapp)
If it is not just about output but also being able to have input available then just have the application start within a terminal session (the screen tool would be a good candidate). The systemd unit can start the screen session on-boot, and you can just attach to that terminal at some point in the future (gaining full control and seeing all the historical output).