10 Mayıs 2022 Salı

bash kodlama - declare built-in komutu

-a seçeneği
Array veya Associative Array tanımlanır

-n seçeneği
name reference içindir. bash 4.3 ile geliyor.

Örnek
Şöyle yaparız
#!/bin/bash

declare -A num word

word=(
 [a]='index_a'
 [b]='index_b'
 [c]='index_c'
)

num=(
 [a]=1
 [b]=2
 [c]=3
)

declare -n var="$1"

printf '%s\n' "${var[@]}"
Çağırmak için şöyle yaparız
bash  array_call_self.sh  word



9 Mayıs 2022 Pazartesi

systemd Nedir

Giriş
Açıklaması şöyle
Systemd is actually a fairly recent project, having been started in ~2010. Many others have been used before it: sysvinit, upstart, init-ng, s6, launchd (I think it had a Linux version once). Several Linux distributions still do not use systemd for various reasons.

Out of all those, systemd is the closest one that you even could call a "process manager". Linux doesn't actually rely on a process manager at all; any process can directly make (fork) a new child process whenever it decides to, uncontrolled. (Indeed so uncontrolled that when systemd started codifying things like "logging out should kill your leftover processes", wars were fought over it.)

The real primary job of systemd and other such programs is only to be a service manager: to automatically start certain specific processes, such as the daemon responsible for displaying the login screen (GDM, agetty) and – sometimes – to restart them when they crash. But once you get to the login screen, everything else can happen without the involvement of systemd/init.

Indeed with sysvinit, the actual init process did incredibly little: about the only service it oversaw was agetty. Literally everything else was done through ordinary shell scripts that never touched init proper. The command to start a service? Shell script. The whole initial boot process? Shell script that runs more shell scripts.
Açıklaması şöyle
At a high level, Systemd typically serves several functions:
  • Init system: Performs boot-time system initialization (e.g. creates or cleans temp files, etc.)
  • Run services at boot (e.g. cron, sshd, mariadb, etc.)
  • PID 1 process: The master process under which all other processes live
  • Process supervisor (a.k.a. process manager): Starts, monitors, restarts additional services
  • Additional services (Systemd does a lot, e.g. logging, mounts, and much more)

Most of these functions can be handled separately, but Systemd "does it all".

3 Mayıs 2022 Salı

Synaptic Package Manager

Giriş
Altta apt komutunu kullanan eski Package Manager. Kurulumu burada