Discussion

How to auto start up a script?

3 4386
Koni  
How can you start up a script automaticly directly after startup in the console of the Banana Pi with Raspbian image?
I have tried to start it from Rc.local but that doesn’t work.
Actually putting it into rc.local should work unless you're script is doing something wrong, e.g. like missing path names, etc.
However, another way to start a script during boot time is to add a cron job with this line
  1. @reboot /path/to/your/script.sh
Copy the Code
This will be executed every time the machine is booted.

Koni  
Rc.local works, but the script it runes won’t start my c++ application in the GUI.
I found another way, I fixed the problem tanks to this question:
http://askubuntu.com/questions/8 ... programs-in-lubuntu
I typed into the console:
  1. Sudo nano /etc/xdg/lxsession/LXDE/autostart
Copy the Code
And appended at the end of the file:
  1. @/home/bananapi/myProgram
Copy the Code
myProgram is a script that starts my c++ application.
This works fine for me

Roy360  
Edited by Roy360 at Wed Jul 15, 2015 13:10

Sorry to bump an old thread, but I'm having a similar problem.


I want my Banana Pi to run 'deluge-web' on startup.

This is my rc.local file, but deluge-web isn't starting.

  1. #!/bin/sh -e
  2. #
  3. # rc.local
  4. #
  5. # This script is executed at the end of each multiuser runlevel.
  6. # Make sure that the script will "exit 0" on success or any other
  7. # value on error.
  8. #
  9. # In order to enable or disable this script just change the execution
  10. # bits.
  11. #
  12. # By default this script does nothing.

  13. # remount filesystem with noatime flag
  14. mount -o remount -o noatime /

  15. # generate new ssh host key
  16. if [ ! -f /etc/ssh/ssh_host_rsa_key ] || [ ! -f /etc/ssh/ssh_host_rsa_key.pub ] ; then
  17.         rm -f /etc/ssh/ssh_host_rsa_key*
  18.         dpkg-reconfigure openssh-server
  19. fi

  20. # cpu frequency
  21. echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  22. echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

  23. echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
  24. echo -n 1150000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  25. echo -n 1150000 >/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
  26. echo 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
  27. echo 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
  28. echo 1 > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy

  29. deluge-web & #<--- WHY ISN'T THIS WORKING?

  30. # echo -n performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  31. # echo -n performance >/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
  32. exit 0
Copy the Code

You have to log in before you can reply Login | Sign Up

Points Rules