INITSCRIPT(5)

πŸ“¦
version 3.14 Β· 2 versions
, in debian bookworm, debian trixie

✨ INITSCRIPT ✨ (section 5, file formats bestie πŸ’–)

okay so picture this: you open up the man page for initscript and it's giving… the humble little glue script that runs EVERYTHING. no cap. she's not famous, she's not flashy, but she is literally the girl behind the curtain. let's get into it πŸŽ€


πŸ’… NAME πŸ’…

initscript β€” the script that executes inittab commands. yeah that's it. that's the whole job description. iconic honestly.


🌸 SYNOPSIS 🌸

/bin/sh /etc/initscript id runlevels action process

look at her. four little arguments and a whole system's worth of responsibility. main character energy fr. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: when the shell script /etc/initscript exists, init will use it to execute the commands from inittab. like, every single one. she's the middleman.

and the whole POINT of that β€” the reason she's even here β€” is that you can use her to set up defaults for every process, things like ulimit and umask values. so instead of setting that stuff a million times, you set it once and every process just inherits the vibe. obsessed. ✨


πŸŽ€ EXAMPLES πŸŽ€

here's a sample initscript β€” she might get installed on your system as /etc/initscript.sample. study her. she ate.

#
# initscript   Executed by init(8) for every program it
#              wants to spawn like this:
#
#              /bin/sh /etc/initscript <id> <level> <action> <process>
#

  # Set umask to safe level, and enable core dumps.
  umask 022
  ulimit -c 2097151
  PATH=/bin:/sbin:/usr/bin:/usr/sbin
  export PATH

  # Increase the hard file descriptor limit for all processes
  # to 8192.  The soft limit is still 1024, but any unprivileged
  # process can increase its soft limit up to the hard limit
  # with "ulimit -Sn xxx" (needs a 2.2.13 or later Linux kernel).
  ulimit -Hn 8192

  # Execute the program.
  eval exec "$4"

see how she sets umask 022, enables core dumps with ulimit -c 2097151, exports that PATH=/bin:/sbin:/usr/bin:/usr/sbin, bumps the hard file descriptor limit to 8192 for all processes, and then finally hits the eval exec "$4" to actually run the program? that's the whole flow. she's a queen and she knows it. πŸ’–


πŸ’€ NOTES πŸ’€

okay real talk time, and I need you to LISTEN: this script is not meant as a startup script for daemons or services. she has nothing to do with an rc.local style script. do not put that on her. πŸ™…β€β™€οΈ

she's just a handler for things executed from /etc/inittab. that's her lane and she stays in it.

and like… experimenting with this can make your system un(re)bootable. un-bootable. as in, cannot boot. as in, your computer becomes a brick. so be careful, bestie, I'm literally begging you. 😭


🌈 FILES 🌈

  • /etc/inittab
  • /etc/initscript

πŸ‘‘ AUTHOR πŸ‘‘

Miquel van Smoorenburg β€” thank you for your service, king 🫢


⭐ SEE ALSO ⭐

go read those too, iykyk πŸ’œ


and that's the whole page, bestie!! this lil cutie comes to you from the sysvinit era, dated July 10, 2003 β€” yes she's vintage, yes she still runs your boot process, and yes she's slaying. mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from