Running Python in background on OS X

后端 未结 5 1885
广开言路
广开言路 2020-12-04 11:27

Is there any way to keep my Python script (with an endless \'while\' loop) running in the background on OS X? Also, for the same purpose, is there any way to have \"autorun\

5条回答
  •  执笔经年
    2020-12-04 12:07

    I tried launchctl and couldn't make it work in El Capitan and searched around little more and found this post

    TL;DR

    Use shebang line #!/usr/bin/env python or #!/path/to/python on your script

    chmod +x test.py
    nohup /path/to/test.py &
    ps ax | grep test.py
    

提交回复
热议问题