# Batch Script At 1st Boot?



## fr33bsd (Aug 22, 2021)

Hi,

during first boot up I would like to place some custom commands, i.e. pkg install screen, to add features, configs, apps to the default installation. Therefore I would like to write sort of bash/sh/zsh script to be executed at the end of first boot.

How to do start a script at the end of the boot sequence?


----------



## ccammack (Aug 22, 2021)

Two common ways to run scripts at startup are to follow the requirements for the `rc.d` system and put them in `/usr/local/etc/rc.d/` or use `cron @reboot`.

There are likely others, but these have worked well enough for me so far.


----------



## Phishfry (Aug 22, 2021)

For one time use look at firstboot scripts in ports tree.
sysutils/firstboot-growfs
sysutils/firstboot-pkgs
sysutils/firstboot-freebsd-update









						firstboot
					

I recently became aware of the firstboot option for rc scripts but The Handbook does not mention anything about the option as far as I can see.  Where would I find any documentation on how to use this?  And would it be possible to install various pkgs as part of a first boot?




					forums.freebsd.org


----------



## leebrown66 (Aug 22, 2021)

rc.conf(5) for the description and rc(5) for an explaination of how it works.  Look for *firstboot_sentinel*.


----------

