Za FreeBSD razvijajo novega sistemskega upravitelja rcd.

Baptiste Daroussin, a member of the FreeBSD Core Team and the author of the pkg package manager, is developing a new system manager for FreeBSD - rcd. The rcd system manager is invoked by the init process instead of /etc/rc, reads service configuration files (/etc/rcd.d/*.ucl), builds a dependency tree, and starts services as parallel as possible with each other, after which it monitors their operation and restarts them if necessary.

Managing background processes and operations with services can be done through direct command transmission to a UNIX socket or using the rctl command line utility. Unit files with service parameters are formatted in UCL, which resembles the configuration file formats of nginx and bind, with elements designed for easier automated processing, borrowed from JSON. Templates for typical unit files can be created, and embedded handlers can be written in Lua. An example of a unit file for starting nginx: name = "nginx"; description = "Nginx HTTP Server"; type = "simple"; command = "/usr/local/sbin/nginx"; command_args = "-g 'daemon off;'"; provides = ["nginx", "http"]; requires = ["NETWORKING", "sshd"]; restart { policy = "always"; max_retries = 10; delay = 2000; backoff = "linear"; } process { user = "www"; group = "www"; cpuset = "0-3"; } rctl { memoryuse = { action = "deny"; amount = "2g"; }; pcpu = { action = "throttle"; amount = "80"; }; }

Instead of working with PID files, the tracking of running processes' activity is done using descriptors returned by the pdfork() system call. There is support for activating services only when accessing a network socket and the ability to protect critical services from forced termination in case of memory shortage in the system. The version of the background process rcd can be updated on the fly without losing state.

To limit the resources available to a service, rctl is used, while complete isolation of services is supported by their launch in jail environments. Access to the controlling UNIX socket can be configured in relation to individual services. Sleep mode transition is supported.

Sistemni menedžer je potpuno kompatibilan s postojećim sistemom sekvencijalnog pokretanja servisa rc.d i može raditi bez izmene postojećih rc.d skripti i konfiguracionih datoteka. Dovoljno je instalirati rcd na aktivni sistem i nakon ponovnog pokretanja sve će nastaviti funkcionisati kao i ranije, osim što će se vreme pokretanja smanjiti zbog paralelizacije pokretanja servisa. Ova kompatibilnost će pojednostaviti migraciju sistema na rcd i omogućiti postupno prevođenje postojećih rc.d skripti u format unit datoteka.

Za kompatibilnost s rc.d podržava se poseban tip unit-a pod nazivom „legacy“. Rcd skenira sadržaj /etc/rc.d/ i /usr/local/etc/rc.d/, analizira naslove PROVIDE/REQUIRE/BEFORE/KEYWORD u skriptama, čita postavke rc.conf i određuje stanje pokretanja skripti, a zatim obrađuje svaku skriptu kao virtuelni legacy unit. U slučaju korišćenja komande rcctl za upravljanje ovim virtuelnim unit-ima, operacije se prevode u stari format, na primer, izvršavanje „rcctl reload sshd“ rezultiraće pokretanjem „/etc/rc.d/sshd reload“.

Izvor: opennet.ru

Kupite zanesljivo gostovanje za spletne strani z zaščito pred DDoS, VPS VDS strežniki 🔥 Kupite zanesljivo gostovanje za spletne strani z zaščito pred DDoS, VPS VDS strežniki | ProHoster