1

I am using an embedded linux with busybox. I would like to automatically run my app called "myApplication" (runlevel 5 after boot all the services are up).

What I have done so far:

  • I made a script under /etc/init.d/ called S90myscript
  • Then I added this line to the inittab:

::sysinit:/etc/init.d/S90myscript

The script contains the following:

! /bin/sh
### BEGIN INIT INFO
# Provides: myApplication
# Should-Start: $all
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 5
# Default-Stop: 0 6
# Short-Description: start myprogram at boot time
### END INIT INFO
#

set -e

. /lib/lsb/init-functions
PATH=/root:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
PROGRAMNAME="myApplication"
case "$1" in
start)
$PROGRAMNAME
;;
stop)
skill $PROGRAMNAME
;;
esac
exit 0

Am I missing something? Symlinks? Is what I did wrong?

Thank you in advance

  • 1
    Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon. – cas Feb 21 '18 at 1:34
0

Found the solution.

  1. I placed myApplication in /usr/sbin/
  2. Created a symlink named myApp to the script located in /etc/init.d/S99myAppScript (notice that there is no .sh and I had to run sudo chmod 755 on this script)
  3. Added the following line at the end of rcS file located in /etc/init.d/ just before the command done:

    myApp &
    

After rebooting the system, myApplication autoruns.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.