0

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!

martineau
  • 119,623
  • 25
  • 170
  • 301
Connor
  • 41
  • 4
  • 1
    This is more of a Linux question than a programming question, and is probably better suited for [linux.se] SE or [SuperUser](https://superuser.com/). Though be sure to check their question guidelines before posting. – Brian61354270 Dec 15 '21 at 22:17
  • Perhaps this could help? https://stackoverflow.com/questions/24518522/run-python-script-at-startup-in-ubuntu – Party-with-Programming Dec 15 '21 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 Dec 15 '21 at 23:52

1 Answers1

1

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).

Raxi
  • 2,452
  • 1
  • 6
  • 10