+ Reply to Thread
Results 1 to 9 of 9
  1. Junior Member
    Join Date
    Nov 2008
    Posts
    1
    #1

    Default init vs. telinit

    I've been looking through tons of websites and books, and can't find a single explanation as to the difference between the init and telinit commands.

    In fact, one book said that the telinit command was an alias shortcut to the init command. How is typing 3 more letters a "shortcut"????

    Can anyone help?

    Thanks!
    Reply With Quote Quote  

  2. SS -->
  3. Senior Member
    Join Date
    Sep 2006
    Location
    San Francisco Bay Area
    Posts
    2,047

    Certifications
    None?
    #2
    I believe they are the same thing my friend. Some authors and distros just prefer one over the other.

    Seemed interesting enough...
    http://www.ncsa.uiuc.edu/UserInfo/Re...s5/telinit.htm
    Reply With Quote Quote  

  4. Senior Member
    Join Date
    Jun 2007
    Posts
    921

    Certifications
    A+, SEC +, CCNA, 642-533, CCNP, C|EH
    #3
    Well the only thing I can see is that

    in SUSE

    telinit is a symlink to init


    So they do the same thing.

    AND,

    if you do a man on telinit you get the init man page....


    So don't really know why telinit exists but init will do the same thing on some distros.
    Reply With Quote Quote  

  5. was here.
    Join Date
    Apr 2008
    Posts
    4,504
    #4
    telinit is used to signal init that you want to change to a different runlevel. You're supposed to use telinit.
    Reply With Quote Quote  

  6. Senior Member
    Join Date
    Jun 2007
    Posts
    921

    Certifications
    A+, SEC +, CCNA, 642-533, CCNP, C|EH
    #5
    Quote Originally Posted by tiersten
    telinit is used to signal init that you want to change to a different runlevel. You're supposed to use telinit.

    Really?


    I didn't know that, usually I just do something like this:



    init 3

    or what ever level I want to change to.

    And when you reboot suse (enterprise) it issues:


    init 6

    since the commands are symlinked together I don't really think it mattes.


    Is telinit an older command to be depriciated?
    Reply With Quote Quote  

  7. was here.
    Join Date
    Apr 2008
    Posts
    4,504
    #6
    Quote Originally Posted by liven
    Is telinit an older command to be depriciated?
    Just doing init <new runlevel> works because at some point, somebody added code to support that. For compatibility with other UNIX systems which may not use the same init, you're still supposed to use telinit. It isn't depreciated.

    A program can tell what name you're executing it as. Just because its a symlink doesn't mean the two copies will do the same thing. There is a mini utility package called busybox which implements a basic version of several utilities. You only ever get 1 binary called busybox. Everything else is symlinked to that. It knows what you're trying to do because of what the symlink names are.
    Reply With Quote Quote  

  8. Senior Member
    Join Date
    Jun 2007
    Posts
    921

    Certifications
    A+, SEC +, CCNA, 642-533, CCNP, C|EH
    #7
    Quote Originally Posted by tiersten
    Quote Originally Posted by liven
    Is telinit an older command to be depriciated?
    Just doing init <new runlevel> works because at some point, somebody added code to support that. For compatibility with other UNIX systems which may not use the same init, you're still supposed to use telinit. It isn't depreciated.

    A program can tell what name you're executing it as. Just because its a symlink doesn't mean the two copies will do the same thing. There is a mini utility package called busybox which implements a basic version of several utilities. You only ever get 1 binary called busybox. Everything else is symlinked to that. It knows what you're trying to do because of what the symlink names are.

    I guess my confusion is that I can not find a telinit command any where on any of the linux boxes I own or admin professionally. telinit is always a symlink to init.

    Now I am sure there are some OS's out there that can tell the different between init and telinit. But on the systems I use/maintain/admin/own when/why would I need to use telinit over init?

    I am asking when is it better to use one over the other. Or, to better phrase the question, what does telinit do that init doesn't do (or vice versa).

    THanks!!
    Reply With Quote Quote  

  9. was here.
    Join Date
    Apr 2008
    Posts
    4,504
    #8
    Quote Originally Posted by liven
    I guess my confusion is that I can not find a telinit command any where on any of the linux boxes I own or admin professionally. telinit is always a symlink to init.
    On Linux it is nearly always a symlink if you're using a standard init. On other UNIX systems it may not be.

    Quote Originally Posted by liven
    Now I am sure there are some OS's out there that can tell the different between init and telinit.
    Any UNIX system can. Most other modern OSes can as well. I'm just pointing out that because its a symlink doesn't mean that both commands will do the same thing. The program can tell the difference.

    On a Linux system:
    If you run telinit then the init binary will know that you've run it as telinit and therefore run the code to send the new runlevel to the real init.

    If you run init then the init binary will know that it isn't PID 1 and therefore will assume that you actually want to do what telinit does. This isn't guaranteed for all UNIX systems.

    Quote Originally Posted by liven
    But on the systems I use/maintain/admin/own when/why would I need to use telinit over init?
    "init <new runlevel>" will work in your case. There is no guarantee that it will work in every system however. "telinit <new runlevel>" should work in every system.
    Reply With Quote Quote  

  10. Senior Member MentholMoose's Avatar
    Join Date
    Sep 2009
    Location
    CA
    Posts
    1,550
    #9
    I have a couple Fedora installs and telinit is not symlinked to init... they are separate binaries. They are part of the "upstart" package.

    Code:
    [mentholmoose@localhost ~]$ which init telinit | xargs ls -l
    -rwxr-xr-x. 1 root root 138312 2009-07-22 05:02 /sbin/init
    -rwxr-xr-x. 1 root root  60504 2009-07-22 05:02 /sbin/telinit
    [mentholmoose@localhost ~]$ cat /etc/redhat-release
    Fedora release 11 (Leonidas)
    [mentholmoose@localhost ~]$ rpm -q upstart
    upstart-0.3.11-1.fc11.x86_64
    Also of potential interest:
    Code:
    [mentholmoose@localhost ~]$ init --help
    Usage: init [OPTION]...
    Process management daemon.
    
    Options:
      -q, --quiet                 reduce output to errors only
      -v, --verbose               increase output to include informational messages
          --help                  display this help and exit
          --version               output version information and exit
    
    This daemon is normally executed by the kernel and given process id 1 to denote
    its special status.  When executed by a user process, it will actually run
    /sbin/telinit.
    
    Report bugs to <fedora-devel-list@redhat.com>
    Reply With Quote Quote  

+ Reply to Thread

Social Networking & Bookmarks