솔라리스10 svcadm 과 svcs 활용하여 서비스 관리하기 (sendmail 등)
참고 사이트
http://blog.naver.com/marufloor?Redirect=Log&logNo=39733748
http://jkwangs.tistory.com/46
* sendmail 서비스
- 서비스 확인
# svcs -a | grep sendmail
online 11월_02 svc:/network/smtp:sendmail
- 서비스 영구 중지
# svcadm disable sendmail
# svcs -a | grep sendmail
disabled 16:56:38 svc:/network/smtp:sendmail
* 참고로 임시 중지에는 다음과 같이 -t 옵션 사용
# svcadm disable -t sendmail
=================================================================
1. 서비스 enable / disable
1-1. telnet
서비스 확인 :
[/]# svcs -a | grep telnet
online 19:21:38 svc:/network/telnet:default
서비스 중지:
[/]# svcs -a | grep telnet
disabled 19:33:28 svc:/network/ftp:default
서비스 시작 :
[/]# svcadm enable telnet
[/]# svcs -a | grep telnet
online 19:40:41 svc:/network/telnet:default
1-2. ftp
서비스 확인 :
[/]# svcs -a | grep ftp
online Aug_04 svc:/network/ftp:default
서비스 중지:
[/]# svcs -a | grep ftp
disabled 19:33:28 svc:/network/ftp:default
서비스 시작:
[/]# svcadm enable ftp
[/]# svcs -a | grep ftp
online 19:42:15 svc:/network/ftp:default
1-3. Sendmail
서비스 확인
[/]# svcs -a | grep sendmail
online Aug_04 svc:/network/smtp:sendmail
서비스 중지:
[/]# svcs -a | grep sendmail
disabled 19:36:06 svc:/network/smtp:sendmail
서비스 시작:
[/]# svcadm enable sendmail
[/]# svcs -a | grep sendmail
online 19:43:10 svc:/network/smtp:sendmail
2. Apache 서비스 enable 문제
2-1. 아파치 서비스를 enable시켰더니 maintenence모드로 전환 되었다
[/]# svcadm enable http
[/]# svcs -a | grep http
qmaintenance 16:33:45 svc:/network/http:apache2
2-2. Apache2 에러 시작 확인
[/]# svcs -xv
svc:/network/http:apache2 (Apache 2 HTTP server)
State: maintenance since Thu Aug 06 16:33:45 2009
Reason: Method failed.
See: http://sun.com/msg/SMF-8000-8Q
See: man -M /usr/apache2/man -s 8 httpd
See: /var/svc/log/network-http:apache2.log
Impact: This service is not running.
2-3. 종속된 서비스는 online 상태 확인
[/]#Svcs –l http
fmri svc:/network/http:apache2
name Apache 2 HTTP server
enabled true
state maintenance
next_state none
Thu Aug 06 16:33:45 2009
logfile /var/svc/log/network-http:apache2.log
restarter svc:/system/svc/restarter:default
contract_id 284
dependency require_all/error svc:/milestone/network:default (online)
dependency require_all/none svc:/system/filesystem/local:default (online)
dependency optional_all/error svc:/system/filesystem/autofs:default (online)
2-4. “See: /var/svc/log/network-http:apache2.log” 참조 파일 확인
[/]# cat /var/svc/log/network-http:apache2.log
1 [ Aug 6 22:40:05 Executing start method ("/lib/svc/method/http-apache2 start") ]
2 [ Aug 6 22:40:06 Method "start" exited with status 96 ]
2-5. /lib/svc/method/http-apache2 파일 확인
9 . /lib/svc/share/smf_include.sh
10
11 APACHE_HOME=/usr/apache2
12 CONF_FILE=/etc/apache2/httpd.conf
13 PIDFILE=/var/run/apache2/httpd.pid
14
15 [ ! -f ${CONF_FILE} ] && exit $SMF_EXIT_ERR_CONFIG
16 #에러메시지 출력 라인 “16”
17 case "$1" in
18 start)
19 /bin/rm -f ${PIDFILE}
20 /bin/mkdir -p /var/run/apache2
21 ssl=`svcprop -p httpd/ssl svc:/network/http:apache2`
22 if [ "$ssl" = false ]; then
23 cmd="start"
24 else
25 cmd="startssl"
26 fi
27 ;;
2-6. /etc/apache2/httpd.conf 파일 확인
[/]# cat /etc/apache2/httpd.conf
cat: cannot open /etc/apache2/httpd.conf #파일 없음
2-7. 폴더로 이동하여 http.conf 예제 파일 확인
[/etc/apache2]# ls
highperformance-std.conf httpd-std.conf magic ssl-std.conf
highperformance.conf httpd.conf-example mime.types ssl.conf
[etc/apache2]#
2-8. 파일 이름 변경하여 카피함
[/etc/apache2]# cp httpd.conf-example httpd.conf
[/etc/apache2]# ls
highperformance-std.conf httpd.conf mime.types
nce.conf httpd.conf-example ssl-std.conf
httpd-std.conf magic ssl.conf
2-9. 서비스 온라인 시키기
서비스의 maintenance 문제가 해결되었다면, disable / enable 시켜야 한다.
[/etc/apache2]# svcadm disable http
[/etc/apache2]# svcs -a | grep http
disabled 23:18:14 svc:/network/http:apache2
[/etc/apache2]# svcadm enable http
[/etc/apache2]# svcs -a | grep http
online 23:18:46 svc:/network/http:apache2
2-10. Httpd 데몬 확인
[/etc/apache2]# svcs -p apache2
STATE STIME FMRI
online 23:18:46 svc:/network/http:apache2
23:18:46 871 httpd
23:18:47 872 httpd
23:18:47 873 httpd
23:18:47 874 httpd
23:18:47 875 httpd
23:18:47 876 httpd
[/etc/apache2]#
2-11. 웹서버 확인을 하기 위해 passwd 파일을 카피함 (html)
[/etc/apache2]# cp /etc/passwd /var/apache2/htdocs/index.html
2-12. 웹서버 확인
2-13. 보안상 passwd 파일 삭제
[/etc/apache2]# rm /var/apache2/htdocs/index.html