How to run an executable file after boot up immediately?

vikranth

New Member
Joined
Jul 21, 2017
Messages
1
Reaction score
0
Credits
0
I have one a.out executable file, now I need to run this file immediately boot up my orange pi. I am using Debian 8.
 


Hey there - welcome to the forum!

There are multiple ways to do this. Regardless of which distribution you run, you can use cron to accomplish running scripts or commands etc.. on boot with a cron entry similar to this:

Code:
@reboot /path/to/script

I use this on one of my servers running CentOS and it works regardless of if i'm rebooting the machine or booting from being shut down. I have heard/read that it may not run from a cold boot but not sure if that's going to be a distribution thing or what.

Give that a shot and let us know if it gets you going.

I'm sure others will come along and post other options for you as well.
 
Use the kernel command line parameter: "init=[absolute_path_to_you_executable]/a.out"

Hahaha. I'm just kidding. I highly doubt that's what you are looking for. I recommend Rob's solution. Use Cronie and apply the crontab entry to the user you want your executable to run as. Ensure that cronie is set to run at boot. This will depend on your init system, but almost all distros these days use systemd. With systemd, as the root user, run "systemctl enable cronie" . As the user you want to execute a.out as, run "crontab -e" . From there you can enter the configuration provided by Rob. If it opens with a text editor you don't like, you can use something like "EDITOR=/bin/nano crontab -e". If you need more granular control over the run sequence of a.out during boot, you'll need to look into setting it up as a systemd service instead. I've never done that so I can't help you with the details there.
 

Members online


Latest posts

Top