Ubuntu startup script in terminal¶
There's many ways of starting a python script at startup, but some of them start the script as a background service (no gui). To make things easier for people unfamilar to ubuntu, it's possible to start the scripts in terminal, so logs can be displayed directly instead of fishing for a log file.
Creating the entry¶
then paste in:
[Desktop Entry]
Type=Application
Exec=gnome-terminal -- bash -c "python3 /home/lin/Octoeverywhere/sentry.py; exec bash"
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=3D Printer Sentry
Comment=Starts python script in a terminal at login to monitor 3d printer status
*Adjust the path to the script, Name and Comment as needed
Save with Ctrl+O, Enter, then exit with Ctrl+X.
Give it exe permission:
The specified script will now run at startup.
Close gui after script exits¶
The ending exec bash deliberately leaves the terminal window open if the script exits. If you prefer the terminal to close automatically, use: