0

I have a python script daemonized using the code in this SO answer.

I created the init.d script at /etc/init.d/MakeDCP with content

#!/bin/bash
python /opt/some/path/to/file/MakeDCPLinux.py start

Then ran update-rc.d MakeDCP defaults

Until here everything is fine. However, after restart the PID file is created and the code goes to the loop but the code is not running when I log in.

The command works from the terminal.

The Linux server is a VM with no GUI.

Community
  • 1
  • 1
Abkarino
  • 1,426
  • 1
  • 12
  • 19
  • Logging in your script should tell you whether it starts at all and where it fails. – JeffRSon Apr 25 '16 at 10:01
  • My code looks the database for pending records else sleep for 1 min. The code enter the while(stop file not exist) but never writes an error or that it exited the code. the line that I am sure it closes on is `time.sleep(60)` – Abkarino Apr 25 '16 at 10:04
  • Check your app for : used a external file(permission,path), additional port, which service required(update-rc.d defaults not a solution, give some time sleep for `all required service is alive` or use service_checker code) – dsgdfg Apr 25 '16 at 10:23
  • @dsgdfg can you explain more ? note that the python logger didn't log any exceptions. – Abkarino Apr 25 '16 at 10:24
  • Because your app not start, nearest top line : sql_connection, file_connection. `try: connect_to_sql; except Exception,e: logger.log(str(e))`. did you have similar code in your app ? – dsgdfg Apr 25 '16 at 10:28
  • I have all code in `try: ... except BaseException as e: logging.exception(e)` – Abkarino Apr 25 '16 at 10:34

0 Answers0