Home > Blockchain >  Discovering information about a Python Script Launched as a Service on Red Hat Linux
Discovering information about a Python Script Launched as a Service on Red Hat Linux

Time:05-06

I have a client who has an existing Red Hat Linux server setup on Amazon Web Services (AWS) where the important Python server code is launched as a service using sudo service bigserver2 start. When I try and run the bigserver2.py Python script independently, there are a number of runtime issues for paths and files not found. How can I backtrack through the service system and understand what environment the service is running in so I can replicate and debug some issues.

I can see the bigserver2 service running when I run sudo service --status-all and it looks like they are initiating a command with some paths added, but I don't know where my predecessor (now gone and unavailable) set things up or what else may impact the environment.

root     14207     1  0 20:15 ?        00:00:00 sudo -u webuser LD_LIBRARY_PATH=/opt/webusershared/python/ext PYTHONPATH=/opt/webusershared/python/ext/ /usr/bin/python3.6 /opt/webusershared/bigserver2.py

CodePudding user response:

Assuming systemd, go look in /lib/systemd/system and /etc/systemd/system for a file that matches the service name. Open that up and see what it's doing. That's likely what the system is using to launch that service.

CodePudding user response:

Since you are using service command instead of systemctl, I am guessing you are on REHL 6 (consider upgrading).

/etc/init.d/

Check this path, you will find a file with a name starting with "bigserver2".

Reference: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s1-services-running

  • Related