Closed jcubic closed 7 months ago
When you start the script directly the current working directory of the script is $HOME. You need to have a wrapper like below to correctly set the path.
index.sh
:
#!/bin/bash
if [[ -L $0 ]]; then
FILE_PATH=$(readlink $0)
else
FILE_PATH=$0
fi
BASE_DIR=$(dirname $FILE_PATH)
exec node $BASE_DIR/index.js
$ chmod +x index.sh
Now start index.sh
.
PS: Depending on your setup you may also need to hardcode the node's path, like /usr/bin/node
It doesn't work, I even tried to run in the terminal from the activation applet and it still closes immediately. Even adding sleep 1m
didn't help.
Add the log. What is in there?
node $BASE_DIR/index.js >& /tmp/log.txt
Yes, sorry it works, I made a silly mistake.
I was testing the library, here is my code:
I'm not sure what the error is but it only works from Bash, If I click on the script file it doesn't work. It looks like the loop doesn't start at all.
I've using node v20.10.0 on Fedora Xfce.