차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | |||
리소스_스크립트_작성법 [2015/12/07 02:32] – zzung | 리소스_스크립트_작성법 [2015/12/07 03:36] (현재) – zzung | ||
---|---|---|---|
줄 101: | 줄 101: | ||
===== service scripts 간략 테스트 방법 ===== | ===== service scripts 간략 테스트 방법 ===== | ||
+ | A normal start-status-stop cycle: 정상 가동 상태 start-status-stop 사이클 | ||
+ | <code vim> | ||
+ | # Service not yet start, status return failure // 서비스가 아직 시작되지 않은 경우에는 status 값을 failure 로 리턴해야 합니다. ( 0 이 아닌 다른값) | ||
+ | $ service script_name status; echo $? | ||
+ | 1 | ||
+ | # Start the service, return success | ||
+ | $ service script_name start; echo $? | ||
+ | 0 | ||
+ | # Already started, status return success | ||
+ | $ service script_name status; echo $? | ||
+ | 0 | ||
+ | # Stop the service, return success | ||
+ | $ service script_name stop; echo $? | ||
+ | 0 | ||
+ | # Service is stopped, status return failure | ||
+ | $ service script_name status; echo $? | ||
+ | 1 | ||
+ | </ | ||
+ | |||
+ | Stop the service even if the service is already stopped: | ||
+ | |||
+ | <code vim> | ||
+ | # Start the service, return success | ||
+ | $ service script_name start; echo $? | ||
+ | 0 | ||
+ | # Stop the service, return success | ||
+ | $ service script_name stop; echo $? | ||
+ | 0 | ||
+ | # Stop the service again, return success | ||
+ | $ service script_name stop; echo $? | ||
+ | 0 | ||
+ | |||
+ | </ | ||
+ | |||
+ | Report error status when the process exit abnormally: 프로세스가 비정상적으로 종료될때 error 상태를 레포트 하세요 | ||
+ | <code vim> | ||
+ | # Stop the service, return success | ||
+ | $ service script_name start; echo $? | ||
+ | 0 | ||
+ | # Already started, status return success | ||
+ | $ service script_name status; echo $? | ||
+ | 0 | ||
+ | # Kill the process | ||
+ | $ killall process_name | ||
+ | # The process was killed, status return failure | ||
+ | $ service script_name status; echo $? | ||
+ | 1 | ||
+ | # Stop the service even if it exited abnormally, return success | ||
+ | $ service script_name stop; echo $? | ||
+ | 0 | ||
+ | </ |