Showing posts with label rhel6. Show all posts
Showing posts with label rhel6. Show all posts

Saturday, June 8, 2019

RHEL6 legacy services

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

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/ch-services_and_daemons

change keyboard to Swiss German:

vi /etc/sysconfig/keyboard

KEYTABLE=”de_CH-latin1″
MODEL=”pc105+inet”
LAYOUT=”de_CH”
KEYBOARDTYPE=”pc”

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 https://en.wikipedia.org/wiki/Xinetd

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
fi


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/rc.sysinit
/etc/inittab
/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



/etc/rc.d/init.d/functions