Easiest Way To Start A Compiled Binary On Boot

0

I compiled a binary from source and to run it for the moment I have to SSH into the server and start it from CLI. I would like to know the easiest way to make it run when the system is booted. I saw a few articles on creating a bash script and placing it in init.d and wonder if there is a better way.

System: Debian Jessie

LinuxStarter

Posted 2017-01-25T02:48:14.040

Reputation: 3

1

Possible duplicate of Autostart run_script on start-up of a machine

– Dmitry Grigoryev – 2017-01-25T09:18:36.270

this is not a script but a binary compiled from source without a init.d, below solution solved it and learned another way to complete this task – LinuxStarter – 2017-02-20T04:51:52.913

Answers

0

If its run as a regular user - just use cron. crontab -e will open up a 'special' text editor instance to edit it. Add a line saying @reboot foo.sh and you're good. Ubuntu's wiki has good documentation on cron as a whole if you want to polish it up as little.

Journeyman Geek

Posted 2017-01-25T02:48:14.040

Reputation: 119 122

will @reboot start it when the system starts? thats a good idea, totally forgot about cron – LinuxStarter – 2017-01-25T03:13:18.167

Yup. And unlike most of the other options, its standard and can be run with regular accounts. – Journeyman Geek – 2017-01-25T03:16:13.083

perfect, will give a try right now and mark your answer – LinuxStarter – 2017-01-25T03:50:18.817

can I do the path to the binary --varible1 --varible2 without using an bash script? Ive dont quite a lot with cron, but this one is new to me, may have done it before, just not recently so I forget if this will work – LinuxStarter – 2017-01-25T03:51:14.260

I'd try it. I usually use a bash script simply cause it lets me manage things more easily. You can test with an arbitrary time in the near future. – Journeyman Geek – 2017-01-25T03:58:53.943

worked as needed, marked – LinuxStarter – 2017-01-26T02:19:20.717