Results 1 to 8 of 8

Thread: setup startup scripts in /etc/rc.local

  1. #1
    Join Date
    Mar 2011
    Beans
    2

    setup startup scripts in /etc/rc.local

    setup startup scripts in /etc/rc.local
    I am very new to Ubuntu Linux. I have installed Ubuntu on a Virtual Machine on my laptop. I am trying to follow this project --

    http://www.geek.com/articles/chips/f...untu-20090116/

    I am stuck on adding the firewall.sh and adding it to the startup scripts in /etc/rc.local. (before Setting Up System Services)

    I'm afraid i don't even know where to start on this. Do i add the file to rc.local or add what is in firewall.sh into rc.local? Please note, i don't even know what editor to use.

    I tried "update-rc.d firewall.sh defaults", but i get a file not found error.

    Any help would be greatly appreciated.

    Thanks,
    Gerry

  2. #2
    Join Date
    Apr 2009
    Location
    ernakulam,kerala,India
    Beans
    5
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: setup startup scripts in /etc/rc.local

    hi,
    to call a script at startup all u have to do is to add a line to /etc/rc.local

    open any editor...go for gedit..

    in terminal ....
    Code:
    $ sudo gedit /etc/rc.local
    and add the complete path of the script..
    eg: /home/YOUR_USERNAME/firewall.sh

    pls make sure u have made the script an execuatable..
    Code:
    $ sudo chmod u+x /home/USERNAME/firewall.sh
    now that u have made the script executable and added it to rc.local..go ahead an reboot ur system..
    Code:
    $ sudo reboot
    hope that helps

  3. #3
    Join Date
    Aug 2007
    Beans
    160

    Re: setup startup scripts in /etc/rc.local

    Quick question: does it support raw bash script inside? Or how exactly are the lines inside treated?

  4. #4
    Join Date
    Apr 2009
    Location
    ernakulam,kerala,India
    Beans
    5
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: setup startup scripts in /etc/rc.local

    when u add a script in rc.local make sure the added script has the bash hash bang..
    ie the first line of the script should be
    Code:
    #!/bin/bash
    else the bash script may not run as expected..because the rc.local itself is run by dash (#!/bin/sh)..which is not bash...so the script within it will also be run by dash...and may run into trouble if there is bash specific stuff in your script.

  5. #5
    Join Date
    Aug 2007
    Beans
    160

    Re: setup startup scripts in /etc/rc.local

    Damn. I new I was doing something wrong.
    Been using /bin/bash in most of scripts, which run totally fine from terminal/console.

    Thank you indeed.

  6. #6
    Join Date
    Apr 2006
    Beans
    3

    Re: setup startup scripts in /etc/rc.local

    Thank you! Worked perfectly on my Lucid Lynx box.

  7. #7
    Join Date
    Apr 2012
    Beans
    11

    Re: setup startup scripts in /etc/rc.local

    does rc.local also run if i login to XBMC instead of Ubuntu?

  8. #8
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu 16.10 Yakkety Yak

    Re: setup startup scripts in /etc/rc.local

    Closed. Please start a new thread for your question; this one is over a year old.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •