Running a custom daemon on start up

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I've got a small project that's based around a raspberry pi. A central part of this project is for my program to be executed on start-up and run until shutdown, all while running stand-alone (that means no SSH). One way I've found is to run my program with nohup, but this still requires an ssh session to start.
I've written the program following the guidelines for creating a linux daemon, yet when I execute it as sudo ./myprogram, it doesn't actually seem to be running as root (it can't to write to the GPIO pins). What is the proper way of going about this?
raspberry-pi startup daemon
add a comment |Â
up vote
0
down vote
favorite
I've got a small project that's based around a raspberry pi. A central part of this project is for my program to be executed on start-up and run until shutdown, all while running stand-alone (that means no SSH). One way I've found is to run my program with nohup, but this still requires an ssh session to start.
I've written the program following the guidelines for creating a linux daemon, yet when I execute it as sudo ./myprogram, it doesn't actually seem to be running as root (it can't to write to the GPIO pins). What is the proper way of going about this?
raspberry-pi startup daemon
1
What Linux distribution are you running on your Raspberry Pi? (Raspbian?) That information might be helpful in figuring out what to do... Your system should have a set of init scripts that run during boot (for instance, look for an/etc/init.ddirectory.) That's usually the proper place to configure scripts to launch daemons on start up.
â Filipe Brandenburger
May 4 at 5:52
Yes, it's the latest version of raspbian. I took a look at that directory but am not sure how to make my own. Is it enough to just doDAEMON=/usr/bin/myDaemonand place my daemon executable in/usr/bin/?
â Astrum
May 4 at 6:24
1
Please state the version you are using, "The latest one" is changing over time!
â MatsK
May 4 at 6:28
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I've got a small project that's based around a raspberry pi. A central part of this project is for my program to be executed on start-up and run until shutdown, all while running stand-alone (that means no SSH). One way I've found is to run my program with nohup, but this still requires an ssh session to start.
I've written the program following the guidelines for creating a linux daemon, yet when I execute it as sudo ./myprogram, it doesn't actually seem to be running as root (it can't to write to the GPIO pins). What is the proper way of going about this?
raspberry-pi startup daemon
I've got a small project that's based around a raspberry pi. A central part of this project is for my program to be executed on start-up and run until shutdown, all while running stand-alone (that means no SSH). One way I've found is to run my program with nohup, but this still requires an ssh session to start.
I've written the program following the guidelines for creating a linux daemon, yet when I execute it as sudo ./myprogram, it doesn't actually seem to be running as root (it can't to write to the GPIO pins). What is the proper way of going about this?
raspberry-pi startup daemon
asked May 4 at 2:56
Astrum
176126
176126
1
What Linux distribution are you running on your Raspberry Pi? (Raspbian?) That information might be helpful in figuring out what to do... Your system should have a set of init scripts that run during boot (for instance, look for an/etc/init.ddirectory.) That's usually the proper place to configure scripts to launch daemons on start up.
â Filipe Brandenburger
May 4 at 5:52
Yes, it's the latest version of raspbian. I took a look at that directory but am not sure how to make my own. Is it enough to just doDAEMON=/usr/bin/myDaemonand place my daemon executable in/usr/bin/?
â Astrum
May 4 at 6:24
1
Please state the version you are using, "The latest one" is changing over time!
â MatsK
May 4 at 6:28
add a comment |Â
1
What Linux distribution are you running on your Raspberry Pi? (Raspbian?) That information might be helpful in figuring out what to do... Your system should have a set of init scripts that run during boot (for instance, look for an/etc/init.ddirectory.) That's usually the proper place to configure scripts to launch daemons on start up.
â Filipe Brandenburger
May 4 at 5:52
Yes, it's the latest version of raspbian. I took a look at that directory but am not sure how to make my own. Is it enough to just doDAEMON=/usr/bin/myDaemonand place my daemon executable in/usr/bin/?
â Astrum
May 4 at 6:24
1
Please state the version you are using, "The latest one" is changing over time!
â MatsK
May 4 at 6:28
1
1
What Linux distribution are you running on your Raspberry Pi? (Raspbian?) That information might be helpful in figuring out what to do... Your system should have a set of init scripts that run during boot (for instance, look for an
/etc/init.d directory.) That's usually the proper place to configure scripts to launch daemons on start up.â Filipe Brandenburger
May 4 at 5:52
What Linux distribution are you running on your Raspberry Pi? (Raspbian?) That information might be helpful in figuring out what to do... Your system should have a set of init scripts that run during boot (for instance, look for an
/etc/init.d directory.) That's usually the proper place to configure scripts to launch daemons on start up.â Filipe Brandenburger
May 4 at 5:52
Yes, it's the latest version of raspbian. I took a look at that directory but am not sure how to make my own. Is it enough to just do
DAEMON=/usr/bin/myDaemon and place my daemon executable in /usr/bin/?â Astrum
May 4 at 6:24
Yes, it's the latest version of raspbian. I took a look at that directory but am not sure how to make my own. Is it enough to just do
DAEMON=/usr/bin/myDaemon and place my daemon executable in /usr/bin/?â Astrum
May 4 at 6:24
1
1
Please state the version you are using, "The latest one" is changing over time!
â MatsK
May 4 at 6:28
Please state the version you are using, "The latest one" is changing over time!
â MatsK
May 4 at 6:28
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can use systemd services to get this job done. It's easier to control your application via systemd have a look at this tutorial https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can use systemd services to get this job done. It's easier to control your application via systemd have a look at this tutorial https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
add a comment |Â
up vote
0
down vote
You can use systemd services to get this job done. It's easier to control your application via systemd have a look at this tutorial https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can use systemd services to get this job done. It's easier to control your application via systemd have a look at this tutorial https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
You can use systemd services to get this job done. It's easier to control your application via systemd have a look at this tutorial https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
answered May 4 at 10:06
user7345878
1
1
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
add a comment |Â
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
Welcome to unix stackexchange and thanks for your reply. While providing sources is always good, it would really help if you could provide an example, links can break.
â thecarpy
May 4 at 11:12
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f441693%2frunning-a-custom-daemon-on-start-up%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
What Linux distribution are you running on your Raspberry Pi? (Raspbian?) That information might be helpful in figuring out what to do... Your system should have a set of init scripts that run during boot (for instance, look for an
/etc/init.ddirectory.) That's usually the proper place to configure scripts to launch daemons on start up.â Filipe Brandenburger
May 4 at 5:52
Yes, it's the latest version of raspbian. I took a look at that directory but am not sure how to make my own. Is it enough to just do
DAEMON=/usr/bin/myDaemonand place my daemon executable in/usr/bin/?â Astrum
May 4 at 6:24
1
Please state the version you are using, "The latest one" is changing over time!
â MatsK
May 4 at 6:28