내 프로그램을 데몬으로 실행하기 위해 다음 프로그램을 작성했지만 실행되지 않습니다. 파이썬 디버거에서 프로그램을 실행하면 작동합니다.
Mac os x를 사용하고 있습니다.
/User/Library/LaunchDaemons/com.bobbob.osx.test.plist
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.bobbob.osx.test</string>
<key>Program</key>
<string>/Users/vivekbhintade/Desktop/test.py</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
/Users/vivekbhintade/Desktop/test.py
:
import urllib2
from datetime import datetime
import smtplib
from smtplib import SMTPException
import threading
def checkerror():
#my code which works fine individually, which sends mail after 5 seconds to recipients.
checkerror()
또한 다음 명령으로 터미널에서 프로그램을 실행합니다.
launchctl load /Library/LaunchDaemons/com.bobbob.osx.test.plist
이로 인해 오류가 발생하지 않습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다