Find the answer to your Linux question:
Results 1 to 6 of 6
I have a few commands that I want to be run on boot up. Login would be OK, but the thing is it needs to be run as root. Is ...
  1. #1
    Linux Newbie Themer's Avatar
    Join Date
    Feb 2008
    Posts
    171

    Startup tasks (on boot, not login)

    I have a few commands that I want to be run on boot up. Login would be OK, but the thing is it needs to be run as root. Is there a folder or something that I can just drop the script in that will do this? And should I be worried about the order? If at all possible I think it should be near the end.
    When I find myself burried in errors, Windows Help appears to me; speaking words of wisdom, Reboot!

  2. #2
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    you can drop them in the file /etc/rc.d/rc.local . in that case they will be run after all initialization is done.
    Linux and me it's a love story

  3. #3
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by khafa View Post
    you can drop them in the file /etc/rc.d/rc.local . in that case they will be run after all initialization is done.
    Bear in mind that this is not true in all cases. What you describe will be valid only for System V compatible init systems. Some distros use that, but some others use a BSD based system. Some others use something else, like Gentoo (it's probably the most flexible init system I've ever found).

    So, if rc.d/rc.local doesn't work, you should try reading the documentation for your distro. Or at least, let us know which distro are you using, so eventually someone familiar with that distro will answer more accurately.

  4. #4
    Linux Engineer khafa's Avatar
    Join Date
    Apr 2008
    Location
    Tokyo, Japan
    Posts
    858
    Quote Originally Posted by i92guboj View Post
    Bear in mind that this is not true in all cases. What you describe will be valid only for System V compatible init systems. Some distros use that, but some others use a BSD based system. Some others use something else, like Gentoo (it's probably the most flexible init system I've ever found).

    So, if rc.d/rc.local doesn't work, you should try reading the documentation for your distro. Or at least, let us know which distro are you using, so eventually someone familiar with that distro will answer more accurately.
    thanx . i did not know. i have to admit i have been naive over this. i tend to use Redhat systems and i did not check for other systems to see if its true or not
    Linux and me it's a love story

  5. #5
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by khafa View Post
    thanx . i did not know. i have to admit i have been naive over this. i tend to use Redhat systems and i did not check for other systems to see if its true or not
    Well, it's just like some kind of common acknowledgment. Most surely, your advice was valid, because the SysV init system could be considered kind of like the standard in linux. Most linux distros use a SysV compatible scheme.

    I just pointed that out in case s/he is using any of "the other distros" that don't do it that way. In any case, there can be always distro specific issues, so, checking the distro documentation (something that people rarely do at all) would never hurt anyway.

  6. #6
    Linux Newbie Themer's Avatar
    Join Date
    Feb 2008
    Posts
    171
    Quote Originally Posted by i92guboj View Post
    Or at least, let us know which distro are you using, so eventually someone familiar with that distro will answer more accurately.
    I'm using Ubuntu 8.04. I never would have guessed that things like this would vary between distros, but hey, I'm not that knowledgeable about the core or I probably wouldn't be asking questions like these!

    Quote Originally Posted by khafa View Post
    you can drop them in the file /etc/rc.d/rc.local . in that case they will be run after all initialization is done.
    OK thanks, from what I see that should work, but if it doesn't, of course I'll be back here soon!
    When I find myself burried in errors, Windows Help appears to me; speaking words of wisdom, Reboot!

Posting Permissions

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