Jump to content

Autostart Program without root privileges


orangepinoob756

Recommended Posts

Hi @all,

 

i built this:

 

https://www.instructables.com/DIY-Lyric-Monitor-for-Stage/ running armbian-OS.

 

In order to have an external power switch, i made this:

 

 

using pin 7 and gnd and it works! the script is successfully doing a shutdown. but, to run that program ("pushbuttons.c" compiled to "pushbuttons") in anything other than root, he wants the password. and i really dont know how to add it to autostart (in "settings"), because i dont know how to fill in the "command" field. like "sudo ./program"? Thank you so much für any help.

 

Link to comment
Share on other sites

13 часов назад, orangepinoob756 сказал:

In order to have an external power switch, i made this:

 

13 часов назад, orangepinoob756 сказал:

using pin 7 and gnd and it works! the script is successfully doing a shutdown.

Do you want to make an external power switch in this way?
Do you want to send a signal to one of the pins of connector 40?
Do you want the device to turn off?

But at the same time, will the 5V power supply to the device be sold?
There are pitfalls here.
Are you interested in knowing them?
And how will the external activation of the device be carried out?

Link to comment
Share on other sites

Hi, thank you for answering!

 

All of those pitfalls are solved. My only problem is: How will the program (file named "pushbuttons") that launches the shutdown-script be launched at every startup? the account that starts by default in the pre-made armbian-image is not root. and as i am no expert in linux, i dont know how it is going to be implemented in the autostart list? which command should be given? the gui lets me choose the autostart-program, but at launch, it won't load.

Link to comment
Share on other sites

My gut feeling was using systemd to run the script, that way root, or in this case systemd issues the commands.

If it is to be run at startup just enable the service and specify `After` and `required` options.
Not sure how you call the script, but you can probably play around it.

https://www.freedesktop.org/software/systemd/man/systemd.service.html

 

Bonus is you get access to journalctl that logs what is going on, extremely useful when debugging.

Edited by bedna
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines