Search code examples
pythonpython-3.xdaemonlaunch-daemon

Daemon with python 3


I am writing a script in python3 for Ubuntu that should be executed all X Minutes and should automatic start after logging in. Therefore I want to create a daemon (is it the right solution for that?) but I haven't found any modules / examples for python3, just for python 2.X. Do you know something what I can work with?

Thank you,


Solution

  • Suppose for python script name is monitor. use following steps:

    • copy monitor script in /usr/local/bin/ (not necessary)

    • Also add a copy in /etc/init.d/

    • Then execute following command to make it executable

      sudo -S chmod "a+x" "/etc/init.d/monitor"

    • At last run update.rc command

      sudo -S update-rc.d "monitor" "defaults" "98"

    this will execute you monitor whenever you login for all tty.