I have a very simple bash script (run-build.sh):
cd /var/www/project npm run build
This script works fine when I run it from the command line but I want to run it every 30 minutes via a cron job:
*/30 * * * * /var/www/project/run-build.sh >> /var/www/test.log 2>&1
Which for some reason doesn't work. I have tried various other approaches such as running the cron job as root user or adding the path to node as part of the cron job. However I haven't managed to find a solution yet which is why I am now posting here.
Anyone have any ideas how to get this cron job to work?