-1

I am using Debian OS I have one executable file (a.out), Now I need to run this file after boot up Immediately.

I tried with etc/rc.local.

Any suggestion?

Thanks.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • yes, my suggestion is rc.local. – Peter Jul 22 '17 at 08:37
  • Can you please send me a sample code? How to add a.out file to rc.local file? – Vikranth Jul 22 '17 at 08:39
  • 1
    No, could you please provide sufficient information about what you have tried? Path to file, permissions of the file and so on. The exact line you added to rc.local. – Peter Jul 22 '17 at 08:49
  • Yes, and if you want help, you should provide more information. Exact line you added to rc.local, path to your a.out and the permissions of a.out. – Peter Jul 22 '17 at 09:02
  • yes, I gave full permissions of a.out file using chmod 755 a.out, in rc.local file added line is /home/user/script.sh – Vikranth Jul 22 '17 at 09:05
  • BTW, it is unusual and against conventions to name today some "system-like" executable as a.out (which is very likely to be some ELF executable). I strongly recommend to name it more meaningfully. – Basile Starynkevitch Jul 22 '17 at 10:02

1 Answers1

2

It greatly depends on your init subsystem, which could be some sysvinit thing with runlevels, some systemd thing, or something else (e.g. runit).

You need to investigate what init your computer (and distribution) has, and dive into the documentation of its init program.

Recent Debian distributions are generally using systemd. See also this.

BTW, read about crontab(5). Perhaps a @reboot entry might be enough. You might use crontab(1) to add it.

Notice that in init related scripts and in crontab jobs, the PATH is not initialized from your user's settings (but has a small system wide default). Practically speaking, better use full executable file path in such things.