Tuesday, August 27, 2013

Melihat dan Menambahkan Service di Linux

melihat dan menambahkan sevice di linux fedora :

command yang digunakan adalah : systemctl 

Starting dan stopping services

systemctl start sshd.service
systemctl stop sshd.service
systemctl restart sshd.service

Menjalankan service otomatis

systemctl enable sshd.service 
systemctl disable sshd.service

Mematikan dan Masking services

contoh matikan service dan child proses

  systemctl kill sshd.service
 
mengirim unix signal ke service berjalan
 
  systemctl kill -s USR1 daemon.service
 
 
membekukan service agar tidak bisa berjalan
 
  systemctl mask sshd.service
dalam contoh ini, systemctl membuatkan symlink dari /etc/systemd/system/sshd.service ke /dev/null.
/etc/systemd membaca dari /lib/systemd. systemd dan tidak akan menjalankan service.
 

Perintah systemd yang lain :

sysVinit command systemd command Notes
service sshd start systemctl start sshd.service Used to start a service (not reboot persistent)
service sshd stop systemctl stop sshd.service Used to stop a service. (not reboot persistent)
service sshd restart systemctl restart sshd.service Used to start and stop a service.
service sshd reload systemctl reload sshd.service When supported, reloads the config file without interrupting pending operations.
service sshd condrestart systemctl condrestart sshd.service Restarts if the service is already running.
service sshd status systemctl status sshd.service Tells whether a service is currently running.
ls /etc/rc.d/init.d/ systemctl list-unit-files --type=service Lists all available services.
chkconfig sshd on systemctl enable sshd.service Always run the service at this target (runlevel.)
chkconfig sshd off systemctl disable sshd.service Do not automatically run the service at this target (runlevel.)
chkconfig --list systemctl list-units -t service --all Print a table of available services and their status.
chkconfig sshd --list ls /etc/systemd/system/*.wants/sshd.service Lists the targets that will include the service.
chkconfig sshd --add systemctl daemon-reload Used when you create a service file or modify any configuration.
telinit 3 systemctl isolate multi-user.target Move system into another target (change runlevels.)
[no comparable command] systemctl show -p "Wants" multi-user.target Lists units pulled in by a given target.
[no comparable command] systemctl show -p "After" sshd.service Shows dependent services and other targets.
[no comparable command] systemd --test --system --unit=multi-user.target Simulates booting the system to a given target
[no comparable command] systemd-analyze plot > boot.svg Generates a diagnostically useful graphical representation of the boot process.
ps xawf -eo pid,user,cgroup,args systemd-cgls Display control group process tree.



No comments: