Results 1 to 6 of 6

Thread: Can I execute a command at boot up?

  1. #1
    Join Date
    Aug 2009
    Location
    South Kent UK
    Beans
    3
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Can I execute a command at boot up?

    Hi all.
    I need to <sudo modprobe ndiswrapper> to start my usb wifi adapter after each reboot it then works perfectly!
    Any idea if I can write some sort of boot script to do this automatically?

  2. #2
    Join Date
    Apr 2009
    Location
    Canada
    Beans
    414
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Can I execute a command at boot up?

    Code:
    gksudo gedit /etc/rc.local
    In the file you will see something like this...
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.

    exit 0
    just put any commands you want executed at startup before exit 0, and it should run with full root privileges and everything.

    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    sudo modprobe ndiswrapper
    exit 0
    Thats probably what you want
    Last edited by Perfect Storm; August 15th, 2009 at 06:11 AM. Reason: changed sudo to gksudo <= gui related

  3. #3
    Join Date
    Dec 2008
    Beans
    110
    Distro
    Kubuntu 10.10 Maverick Meerkat

    Re: Can I execute a command at boot up?

    You can. Here is a very good guide on what runlevels you can place your startup scripts.

    http://linux.com/news/enterprise/sys...nd-rcd-scripts
    Happy geeks are effective geeks!
    AMD Athlon II X2 250 (3.0ghz), Gigabyte GA-MA770T-UD3P, 3GB Crucial DDR3-1066Mhz RAM, XFX ATI RadeonHD 5750 1GB GDDR5

  4. #4
    Join Date
    Aug 2009
    Location
    South Kent UK
    Beans
    3
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Can I execute a command at boot up?

    Thanks Finalfantasykid just tried and it works perfectly.
    and Firestorm4 thanks for the link.

    I've spent so many years behind WINDOWS this really is a breath of fresh air!!

  5. #5
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Can I execute a command at boot up?

    Quote Originally Posted by Firestem4 View Post
    You can. Here is a very good guide on what runlevels you can place your startup scripts.

    http://linux.com/news/enterprise/sys...nd-rcd-scripts
    Ubuntu now uses upstart and as such runlevels are somewhat outdated.

    http://lwn.net/Articles/202779/
    Last edited by bodhi.zazen; August 15th, 2009 at 12:30 AM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  6. #6
    Join Date
    Dec 2008
    Beans
    110
    Distro
    Kubuntu 10.10 Maverick Meerkat

    Re: Can I execute a command at boot up?

    Quote Originally Posted by bodhi.zazen View Post
    Ubuntu now uses upstart and as such runlevels are somewhat outdated.

    http://lwn.net/Articles/202779/

    well looky there... Didn't even know that had changed lol...
    Happy geeks are effective geeks!
    AMD Athlon II X2 250 (3.0ghz), Gigabyte GA-MA770T-UD3P, 3GB Crucial DDR3-1066Mhz RAM, XFX ATI RadeonHD 5750 1GB GDDR5

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
  •