I recently created a rails 3.0.5 app, and it appears that this line was added to my crontab:
8,28,48 * * * * /home/<user>/webapps/<app>/bin/start
As a result, I get emails every 20 minutes with the following errors, presumably because it's trying to start an nginx instance that's already running:
[emerg]: bind() to 0.0.0.0:11323 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:11323 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:11323 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:11323 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:11323 failed (98: Address already in use)
[emerg]: still could not bind()
I changed the line in my crontab to run restart
instead of start
, but I'm not sure whether it's even necessary. Should I just delete it?
asked
04 Aug '11, 01:35
chrispix
30●1●4●7
accept rate:
100%
Hi,
You should not remove as it is meant to restart your in case its nor unning. You can instead redirect its output to /dev/null by adding "> /dev/null 2>&1"
@neeravk isn't it better to run restart then, since it's most likely already running? I've never seen this on an nginx installation before.
[Edit] Using restart is fine. However, it will terminate active sessions, so redirecting the output to /dev/null will allow this to fail silently as expected.
Ah, good point about sessions. Thanks @johns!