Saturday, June 8, 2019

RHEL6 legacy services

just upgrade to RHEL7 please.... or RHEL8...

change keyboard to Swiss German:

vi /etc/sysconfig/keyboard


shutdown -r now

cat /etc/inittab should tell you id:5:initdefault: which is the default runlevel

runlevel checks current runlevel

system-config-services UI utility to configure services

service bla status

services are defined in /etc/rc.d/init.d/

ls /etc/xinetd.d here other services

ntsysv to enable/disable services to startup ( ntsysv --level 35 will edit runlevel 3 and 5)

chkconfig --list or chkconfig --list httpd

chkconfig httpd on or chkconfig httpd on --level 35
chkconfig httpd off or chkconfig httpd off --level 35

service --status-all

service httpd start

/var/lock/subsys/ -> " lock files created by their init scripts" see here

before start:
if [ ! -f /var/lock/subsys/servicename ]; then
start # start service here

at the end of start:
touch /var/lock/subsys/servicename

at the end of stop:
rm -f /var/lock/subsys/servicename

WARNING: stale files could linger if abrupt shutdown -> always check also existence of PID (must write PID file)

What happens at boot?
/etc/rc.d/rcN.d (N = current runlevel)

Template for service scripts is in /usr/share/doc/initscripts-*/sysvinitfiles

sudo stat /proc/1/exe -> /sbin/init
stat /sbin/init -> /lib/systemd/systemd
/sbin/init --version


No comments: