Skip to main content
2 of 2
added 100 characters in body
Amith
  • 323
  • 1
  • 2
  • 11

bash: script running in pm2 unable to access file descriptors files at /dev/fd/

I have script script.sh:

#!/usr/bin/env bash # pm2 seems to always run in `bash` regardless of `#!` echo "running in $(readlink -f /proc/$$/exe)" # Redirect to both stdout(1) and stderr(2) echo "hello" | tee /dev/fd/2 

I am running it with pm2 start script.sh

I can see logs at pm2 logs like so:

tee: /dev/fd/2: No such device or address 

Which means script is unable to access /dev/fd. Although this problem doesn't happen when directly running in a bash terminal.


Amith
  • 323
  • 1
  • 2
  • 11