Hi, When I reboot my server I get following.
starting network daemons: sshd snmpd ifstated sendmail initd.
starting local daemons:.
NginxTerminated
starting daemons: cron.
My rc.local file....
----------------------------------------------------------------------------------------
# Add your local startup actions here.
echo '.'
if [ -x /usr/local/sbin/nginx ]; then
echo -n ' Nginx'; /usr/local/sbin/nginx
fi
----------------------------------------------------------------------------------------
If I log into the server as root and just run /usr/local/sbin/nginx then
Nginx starts up fine. I've tried changing the rc.local file around but
each time I reboot the server i see Terminated in the boot text. Below
is my ifstated script that I have been trying to use to get nginx
started. I've disabled ifstated justnow till I get nginx auto starting
as the server boots but interestingly my ifstated script kind of works
if nginx is up and running and If I kill the process it restart it but
ifstated won't start nginx from cold. (if this makes sense)
Finally... my nginx install isn't standard. It's syslog patched and has
an the header-more module compiled in. I'm not very fluent at creating
users / groups so to get the nginx user accounts that are needed I just
installed nginx from a package then compiled and reinstalled nginx from
source on top of the package. Not sure if this is the reason why it
won't start.
----------------------------------------------------------------------------------------
# cat /etc/ifstated.conf
init-state auto
nginx_check = '( "ps -aux | grep \"nginx\" | grep -v grep | wc -l | grep
6" every 5)'
state auto {
if $nginx_check {
set-state nginx_online
}
if ! $nginx_check {
set-state nginx_offline
}
}
state nginx_online {
init {
run "echo Nginx Up : $(date) >> /var/log/ifstated.log"
}
if ! $nginx_check {
set-state nginx_offline
}
}
state nginx_offline {
init {
run "echo Nginx Down : $(date) >> /var/log/ifstated.log"
run "pkill nginx | sleep 5"
run "nginx -c /etc/nginx/nginx.conf"
}
if $nginx_check {
set-state nginx_online
}
}
----------------------------------------------------------------------------------------
If anyone can help me then it would really be appreciated.
Thanks
Keith