I am trying to figure out why my process doesn't work if started via a script, but works fine if started by hand.

Here's the details:

script is a resque worker start script. The script location is /etc/monit/conf.d/start_resque.sh. Permissions are 755 and owned by ubuntu:ubuntu

When I run the script, the log output gets a pid and it says "starting worker ip-xx-xxx-xxx-xx:26732 (or whatever the pid is)", however when I ps aux | grep 26732, nothing is shown as running. When I run the same exact command by hand in my rails project directory, the same "starting worker" output is displayed, and the process is actually started and continues to run. One thing to note, additional output is displayed if started by hand: "nohup: ignoring input"

Another question someone might be able to help with, is why does BACKGROUND=yes not actually daemonize my worker...thus I'm resorting to nohup, which seems to work fine.

Here's my script (the command I run by hand is after the cd):

echo "starting worker.."
workercount="$(ps aux | grep -c resque)"
cd $currentdir
nohup bundle exec rake environment resque:work RAILS_ENV=production QUEUE='*' VERBOSE=1 PIDFILE=$pidfile >> $logdir 2>&1 &
echo "started worker $workercount! view log at $logdir. view pidfile at $pidfile"

Additional notes: on Ubuntu 12.04 and am connected via ssh while running both the script and the manual command.

  • Try running pstree to see if the child ( your background process ) was adopted by init ;) Apr 22, 2013 at 19:07
  • I don't think it has been, since I don't see it there. I do see redis-server, but no children attached to that process.
    – Danny
    Apr 22, 2013 at 22:49

1 Answer 1


Ok I switched to Sidekiq and it "just works". Lots of lost time mucking around with resque and deploying, but I gained some xp and almost leveled up in my sysadmin skill. Sidekiq seems a better option - it takes advantage of threads and has a great wiki, updated web interface, a pro option, and a really cool ninja icon on their homepage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .