I have a shell script that starts a passenger instance if it is not running:
#!/bin/bash
/usr/sbin/lsof -i :82 > /home/var/www/site-owner/data/www/site.com/currenttest
if [ ! -s /home/var/www/site-owner/data/www/site.com/currenttest ];
then
cd /home/var/www/site-owner/data/www/site.com/current/
passenger start -p 82 -d -e production --user site-owner
fi
It works very good if I start it from root ssh environment.
I tried to start it from crontab and it didn’t start with error: “passenger_loader.sh: line 12: passenger: command not found”.
By many hours of googling I found crontab from root user and root console user have different environments but, anyway, I don’t understand how to make a crontab root user run scripts like root console user. I started to add
source ~/.bash_profile
source ~/.bashrc
to a script but it didn’t change anything.
I dont’t know if it is a solution, but it works like I need (I started it from bash):