Този сайт използва бисквитки (cookies). Ако желаете можете да научите повече тук. Разбрах
Skip navigation

CentOS / RHEL: Проверка за стартирана услуга

6490 прочитания, 2

Въпрос: как може да се разбере дали дадена услуга като MySQL или Apache е стартирана или не на Centos/RHEL/Fedora Linux сървър?

Отговор: необходимо е използването на командата service:

# вариант 1
service
SERVER stats 

# вариант 2

/etc/init.d/SERVER stats

Пример

За да разберете дали има стартиран mysqld процес (MySQL сървър) изпълнете:

# service mysqld status

Примерен изход

mysqld (pid 7556) is running...

Намиране статуса на всички стартирани услуги

Параметърът --status-all стартира скрипт, който изпълнява горната команда за всички услуги в азбучен ред:

# service --status-all

Примерен изход

....
...
.....
irqbalance (pid 2183) is running...
iscsi is stopped
iscsid is stopped
Kdump is operational
i5k_amb-isa-0000
Adapter: ISA adapter
Ch. 0 DIMM 0: +63.0°C (low = +127.5°C, high = +127.5°C)
Ch. 0 DIMM 1: +56.5°C (low = +127.5°C, high = +127.5°C)
Ch. 1 DIMM 0: +62.0°C (low = +127.5°C, high = +127.5°C)
Ch. 1 DIMM 1: +49.0°C (low = +127.5°C, high = +127.5°C)
Ch. 2 DIMM 0: +54.0°C (low = +127.5°C, high = +127.5°C)
Ch. 3 DIMM 0: +49.0°C (low = +127.5°C, high = +127.5°C)
 
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +37.0°C (high = +78.0°C, crit = +100.0°C)
Core 1: +38.0°C (high = +78.0°C, crit = +100.0°C)
Core 2: +34.0°C (high = +78.0°C, crit = +100.0°C)
Core 3: +38.0°C (high = +78.0°C, crit = +100.0°C)
 
coretemp-isa-0001
Adapter: ISA adapter
Core 0: +40.0°C (high = +78.0°C, crit = +100.0°C)
Core 1: +40.0°C (high = +78.0°C, crit = +100.0°C)
Core 2: +39.0°C (high = +78.0°C, crit = +100.0°C)
Core 3: +39.0°C (high = +78.0°C, crit = +100.0°C)
 
w83627hf-isa-0290
Adapter: ISA adapter
in0: +4.08 V (min = +0.00 V, max = +4.08 V)
in1: +4.08 V (min = +0.00 V, max = +4.08 V)
in2: +4.08 V (min = +2.82 V, max = +3.79 V) ALARM
in3: +3.07 V (min = +4.08 V, max = +4.05 V) ALARM
in4: +3.12 V (min = +4.08 V, max = +4.08 V) ALARM
in5: +3.15 V (min = +4.08 V, max = +4.06 V) ALARM
in6: +3.20 V (min = +4.08 V, max = +4.06 V) ALARM
in7: +3.28 V (min = +3.82 V, max = +4.06 V) ALARM
in8: +3.28 V (min = +4.06 V, max = +4.06 V) ALARM
fan1: 0 RPM (min = 0 RPM, div = 2)
fan2: 0 RPM (min = 0 RPM, div = 2)
fan3: 0 RPM (min = 0 RPM, div = 2)
temp1: -48.0°C (high = +60.0°C, hyst = +55.0°C) sensor = thermistor
temp2: -48.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor
temp3: -48.0°C (high = +80.0°C, hyst = +75.0°C) sensor = thermistor
cpu0_vid: +1.419 V
beep_enable:enabled
 
lvmetad is stopped
mdmonitor is stopped
memcached (pid 45560) is running...
messagebus (pid 7066) is running...
mysqld (pid 7556) is running...
netconsole module not loaded
Configured devices:
lo eth0 eth1
Currently active devices:
lo eth0 eth1
rpc.svcgssd is stopped
rpc.mountd (pid 7199) is running...
nfsd (pid 7262 7261 7260 7259 7258 7257 7256 7255) is running...
rpc.rquotad (pid 7195) is running...
rpc.statd (pid 2215) is running...
ntpd (pid 7295) is running...
master (pid 7649) is running...
Process accounting is enabled.
ipmi_msghandler module not loaded.
ipmi_si module not loaded.
ipmi_devintf module not loaded.
/dev/ipmi0 does not exist.
quota_nld is stopped
rdisc is stopped
.....
..

Командите ps и pgrep

Същият резултат може да бъде постигнат при използване на командните ps и pgrep:

# ps aux | grep 'serviceNameHere'
# ps aux | grep 'mysqld'

или

# pgrep serviceNameHere

## match user name ##
# pgrep -u userName serviceNameHere

# pgrep mysqld

# pgrep -u mysql mysqld

(28.08.2013)

КОМЕНТАРИ

 
  
14:23, 30 април 2015 # 1
NO AVATAR
Hi everybody, you have done the superb job guys. I am much impressed to you! repair credit
 
  
10:37, 09 май 2016 # 2
NO AVATAR
These are the great blogs; I assure you that I really enjoyed a lot in reading.reviews of quantum success coaching academy
Трябва да сте регистриран потребител, за да коментирате статията
"CentOS / RHEL: Проверка за стартирана услуга"



    

© Ай Си Ти Медиа ЕООД 1997 - 2017 съгласно общи условия за ползване