I am having cron run a shell script which includes this line...

/etc/init.d/nginx reload

but it is giving me an exit code of 2...What can I do to reload nginx from cron successfully?

  • Does /etc/init.d/nginx reload run successfully from command line? – heemayl Mar 25 '16 at 17:00
  • yes it most certainly does – deltaskelta Mar 25 '16 at 17:08
  • Then it should work on cron too..what cron entry you have exactly? – heemayl Mar 25 '16 at 17:09
  • like I said, my cronjob is calling a .sh script which is logging things to files, I was getting some strange behavior on some if statements so I logged the exit code and this one was 2. It may be restarting nginx but just returning a different code, IDK – deltaskelta Mar 25 '16 at 17:19