1

i got an executable which i would like to run at startup.

First of all i checked if my executable works in terminal:

/absolute/path/to/executable

-> works

So i added it to my rc.local:

/absolute/path/to/executable

-> didnt work at startup

As this executable runs infinite, i changed it to:

/absolute/path/to/executable &

-> didnt work at startup

So i thought, maybe it needs some time before i can run it, so:

/bin/sleep 30 && /absolute/path/to/executable &

-> didnt work at startup

Well here i am with my rc.local not working.

What did i do in addition to that?

I tested if i can trigger rc.local directly by:

sudo sh /etc/rc.local

works, after 30 seconds my service appears with its process id !

So what is wrong in my setup?

Thanks and Greetings!

Creative crypter
  • 1,348
  • 6
  • 30
  • 67
  • Wrong site. You're looking for [ubuntu.se] or [su] instead. This site is for programming related questions, not general computer or OS support. The [help] has more information if you need it. – Ken White Jan 13 '18 at 23:02
  • might this be informative: https://askubuntu.com/questions/9853/how-can-i-make-rc-local-run-on-startup ? –  Jan 13 '18 at 23:04

2 Answers2

0

chmod +x /etc/init.d/rc.local

vi /etc/rc.local

Replace #!/bin/sh -e to #!/bin/bash

sudo systemctl enable rc-local.service

sudo reboot

Balaji
  • 111
  • 4
0

I had the same issue and tried all same suggestions on Ubuntu 16 with no luck (my rc.local executes fine on Ubuntu 18)

Here's my working hack:

Open up startup applications and add a new job.

I used this for the command:

bash /etc/rc.local

Make sure the script is executable (chmod it)

And that's it... You could do this with any script... it doesn't have to be rc.local... see the screenshot for clarity:

enter image description here