맥 자동실행 관련

1. Sleep에서 깨우기

특정 시간에 Sleep모드에서 깨우기
$ sudo pmset repeat wakeorpoweron MTWRFSU 23:10:00

확인
$ pmset -g sched

지우기
$ sudo pmset repeat cancel

2. Launchctl 관련

서비스 등록
$ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.myservice.plist

서비스 자동실행 등록
$ launchctl enable gui/$(id -u)/com.example.myservice

상태 확인
$ launchctl print gui/$(id -u)/com.example.myservice

목록 확인
$ launchctl list | grep com.example.myservice
서비스 자동실행 해제
$ launchctl disable gui/$(id -u)/com.example.myservice

서비스 등록 해제
$ launchctl bootout gui/$(id -u)/com.example.myservice

plist 삭제
$ rm ~/Library/LaunchAgents/myservice.plist

bootstrap > enable > disable > bootout 이후 같은 레이블명으로 재등록을 하려면 문제가 발생함. 이는 disable을 하면 서비스 실행 여부뿐 아니라 등록 자체를 막는 플래그가 남음. 따라서 enable > bootstrap 순으로 진행해야 함.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다