Results 1 to 7 of 7

Thread: How do I make a script that automaticlly restarts samba on boot?

  1. #1
    Join Date
    Jan 2009
    Location
    AZ
    Beans
    34
    Distro
    Ubuntu 11.04 Natty Narwhal

    Post How do I make a script that automaticlly restarts samba on boot?

    I was wondering how do I make a bash script that automatically restarts samba after all the services are running? The reason I ask is because ubuntu 9.10 has a bug where smb is conflicting with nmbd and if I restart smb at boot it fixes the problem. So I just need it where the system automatically restarts smb. Thank you.
    "Everybody lies." ~Dr.House

  2. #2
    Join Date
    Apr 2008
    Location
    Far, far away
    Beans
    2,148
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How do I make a script that automaticlly restarts samba on boot?

    You can add a line to /etc/rc.local - it is run after all other init scripts.
    eg. add,
    /etc/init.d/samba restart

  3. #3
    Join Date
    Jan 2009
    Location
    AZ
    Beans
    34
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How do I make a script that automaticlly restarts samba on boot?

    Thank you, but why does it say that this script does nothing by default? And do I need to keep the exit 0 also?
    "Everybody lies." ~Dr.House

  4. #4
    Join Date
    Apr 2008
    Location
    Far, far away
    Beans
    2,148
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How do I make a script that automaticlly restarts samba on boot?

    It says that because by default there are no commands added to the script.
    Make sure you add any line you wish to run before the exit line, otherwise it will exit before it runs your command.

  5. #5
    Join Date
    Jan 2009
    Location
    AZ
    Beans
    34
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How do I make a script that automaticlly restarts samba on boot?

    Thank you very much, that solved my problem. ^_^
    "Everybody lies." ~Dr.House

  6. #6
    Join Date
    Jan 2010
    Beans
    3

    Re: How do I make a script that automaticlly restarts samba on boot?

    hmmm question of curiosity...

    Why isn't a sudo command/sudoers edit needed in this script?

  7. #7
    Join Date
    Apr 2008
    Location
    Far, far away
    Beans
    2,148
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: How do I make a script that automaticlly restarts samba on boot?

    rc.local runs as root during the init sequence.

Tags for this Thread

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
  •