I am trying to create an Ubuntu Service on an EC2 Ubuntu Instance that simply executes a shell script that runs a python scripts. When running the shell script in terminal, the python executes perfectly. When the service runs, however, the shell script runs but hangs when it gets to the python script.
The shell script:
#! /usr/bin/bash -lecho "running!"/home/ubuntu/absolute/path/to/virtualenv/bin/python /home/ubuntu/absolute/path/to/pythonscript.py
The Ubuntu Service:
[Unit]Description=Python Script DescriptionsWants=network-online.targetAfter=network-online.target syslog.target[Service]ExecStart="/home/ubuntu/shell_script.sh"[Install]WantedBy=default.target
The echo command runs in the shell script so I know it the script runs, but the script stops before any python is run and simply hangs. There is no output of any kind when I check journalctl.
The python script itself is a function called within a 'While True' loop in an attempt to have the function run again after it completes. It requires a network connection to ping a 3rd party API and put the data into an AWS Dynamodb database, but does not require any human interaction nor any GUI nor any any access to existing drives on the server. The goal is to have this script running 24/7, entirely in the background.
Any help on this issue would be massively appreciated, thank you.