2

I have written a python script to add an App Indicator at the menu bar in ubuntu.

I want to run it as a service which starts on system startup.

I tried looking at other answers but none of them worked for me as they were outdated, used deprecated features or simply didn't work for me.

I'm using Ubuntu 16.04.

Please guide me. Thank You

3

There is difference if you need to run as service or simply run it, because your question implies that simply running it would be enough.

To auto start a program/script

Use Startup Applications program in your Ubuntu.

Put the (executable) script somewhere and create a new entry that basically just point to the script.
Make sure that the script has a proper shebang: #!/usr/bin/env python or similar.
Also make sure that the entry is enabled.

What this does is basically creates a new .desktop file in ~/.config/autostart. You can hack away at that desktop file to your heart's content, just dont remove the X-MATE-Autostart-enabled=true (this line could be slightly different depending on your DE)

To create a proper service

Ubuntu 16 uses systemd and you need to create a service for that. Creating a systemd service is a bit more difficult, but there are plenty of good guides like:

However it is mostly used for background daemons, not indicators or other GUI things, so you should stick with Startup Applications.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.