my shell script
#!/bin/bash
pm2 start server.js
my crontab task
* * * * * /home/ec2-user/abcd/test.sh > /home/ec2-user/cron.log 2>&1
What I got from the log:
home/ec2-user/abcd/test.sh: line 2: pm2: command not found
how to fix it?
Remark:
1.When I execute ./test.sh, it runs normally
2.which pm2 - shows
~/.nvm/versions/node/v14.16.1/bin/pm2