DVR PostProcessing Script not executing

Ok, so after unsuccessfully digging through the plex server logs I started to monitor the the journal of systemd for the plexmediaserver service. Turns out, that the user plex didn’t have the same environment set up as when you substitute user to plex. The journal showed that the binary I used in the script was missing a linked library. I searched this forum and found other users having run into a similar issue (but with FFmpeg). I was able to resolve my issue by adding the following lines (ubuntu 18.04 LTS) at the beginning of the script:

LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
export LD_LIBRARY_PATH