# FreeBSD 8/9/10 Startup process



## bsaidus (Sep 12, 2015)

Hello.
 , After that the kernel is loaded into memory, it starts the process /sbin/init which read the file /etc/rc... Please,  is there any docs that illustrate the startup process from loading the kernel to displaying the login invite?
Thanks.


----------



## kpa (Sep 12, 2015)

The rc(8) manual page should be a good starting point.


----------



## bsaidus (Sep 12, 2015)

kpa said:


> The rc(8) manual page should be a good starting point.


I'll start with it.


----------



## SirDice (Sep 14, 2015)

Chapter 12. The FreeBSD Booting Process


----------



## bsaidus (Sep 22, 2015)

Thanks, Until that point it's ok.
But I wonder how to put a program or shell script to execute after the login process (some thing like in pfSense or OPNsense).
I.e: after login (or even no login) my program (binary or shell) starts, give me to choose from deferent choices amoung them, acceding  to  the shell, and after exiting (logout, exit) from the shell, I will return to my program.

Any idea about that ??
Thanks.


----------



## SirDice (Sep 22, 2015)

Once init has started it will start the rc(8) scripts according to rcorder(8). If you need to start your own daemons or application you need to create an rc(8) script or start it from /etc/rc.local.


----------



## usdmatt (Sep 22, 2015)

Never actually tried any of this, but the shell is just an executable, so you should be able to just change the shell of your user to your application. (Using something like `chsh [I]username[/I]`). As soon as the user is logged in, it should instantly drop them in your program. I'm not sure what happens when the program exits though; Something for you to test out...

If you want to provide a menu of options, including a 'real' shell, print out your list of choices; If they choose shell, just execute /bin/sh, or whatever shell you want. When that executable finishes and returns to your program, loop back to displaying your menu.

For autologin, you may be able to mess with /etc/ttys & /etc/gettytab. I think ttyv0 is the main terminal you get on a normal boot. It's set to use the Pc gettytab entry. If you look in the gettytab file, there are some examples for 'autologin'. These are set for root although you can probably change that (or create your own autologin entry with a different name and set the terminal to use that). I have no idea if any of that will work but it stands a chance.


----------



## bsaidus (Sep 25, 2015)

usdmatt said:


> Never actually tried any of this, but the shell is just an executable, so you should be able to just change the shell of your user to your application. (Using something like `chsh [I]username[/I]`). As soon as the user is logged in, it should instantly drop them in your program. I'm not sure what happens when the program exits though; Something for you to test out...
> 
> If you want to provide a menu of options, including a 'real' shell, print out your list of choices; If they choose shell, just execute /bin/sh, or whatever shell you want. When that executable finishes and returns to your program, loop back to displaying your menu.
> 
> For autologin, you may be able to mess with /etc/ttys & /etc/gettytab. I think ttyv0 is the main terminal you get on a normal boot. It's set to use the Pc gettytab entry. If you look in the gettytab file, there are some examples for 'autologin'. These are set for root although you can probably change that (or create your own autologin entry with a different name and set the terminal to use that). I have no idea if any of that will work but it stands a chance.


You're the man!
I think I finally find the WONDERFUL OS that I desired!
Thanks.


----------

