-3

I mean when I power up the pi my c++ file should be automatically executed. Please anyone guide me through steps. Any help would be highly appreciated.

user0042
  • 7,917
  • 3
  • 24
  • 39
  • https://stackoverflow.com/questions/7221757/run-automatically-program-on-startup-under-linux-ubuntu – tkausl Oct 29 '17 at 05:19
  • 1
    This has nothing to do with c++. Just configure the executable generated from the c++ source in your inittab. – user0042 Oct 29 '17 at 05:19
  • create a systemd unit file for your program... https://www.raspberrypi.org/documentation/linux/usage/systemd.md – Varun Oct 29 '17 at 05:25
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Raspberry Pi Stack Exchange](http://raspberrypi.stackexchange.com/), [Internet of Things Stack Exchange](http://iot.stackexchange.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Oct 29 '17 at 06:33

1 Answers1

0

If you are looking for a solution that works on bootup to the console, take a look at this link. Basic rundown:

Create a file for your startup script and write your script in the file:

$ sudo nano /etc/init.d/superscript

Save and exit: Ctrl+X, Y, Enter

Make the script executable:

$ sudo chmod 755 /etc/init.d/superscript

Register script to be run at startup:

$ sudo update-rc.d supersc
youssef
  • 65
  • 1
  • 8