Starting Resque worker with script doesnt work, starting by hand does

Clash Royale CLAN TAG#URR8PPP
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):
#!/bin/bash
echo "starting worker.."
workercount="$(ps aux | grep -c resque)"
currentdir="/var/www/apps/myapp/current"
logdir=$currentdir/log/resque_worker.log
pidfile=$currentdir/tmp/pids/resque_worker_$workercount.pid
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.
ubuntu shell-script nohup
add a comment |
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):
#!/bin/bash
echo "starting worker.."
workercount="$(ps aux | grep -c resque)"
currentdir="/var/www/apps/myapp/current"
logdir=$currentdir/log/resque_worker.log
pidfile=$currentdir/tmp/pids/resque_worker_$workercount.pid
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.
ubuntu shell-script nohup
Try runningpstreeto see if the child ( your background process ) was adopted by init ;)
– Rany Albeg Wein
Apr 22 '13 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 '13 at 22:49
add a comment |
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):
#!/bin/bash
echo "starting worker.."
workercount="$(ps aux | grep -c resque)"
currentdir="/var/www/apps/myapp/current"
logdir=$currentdir/log/resque_worker.log
pidfile=$currentdir/tmp/pids/resque_worker_$workercount.pid
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.
ubuntu shell-script nohup
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):
#!/bin/bash
echo "starting worker.."
workercount="$(ps aux | grep -c resque)"
currentdir="/var/www/apps/myapp/current"
logdir=$currentdir/log/resque_worker.log
pidfile=$currentdir/tmp/pids/resque_worker_$workercount.pid
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.
ubuntu shell-script nohup
ubuntu shell-script nohup
edited May 27 '13 at 7:32
Anthon
61k17104166
61k17104166
asked Apr 22 '13 at 17:50
DannyDanny
19117
19117
Try runningpstreeto see if the child ( your background process ) was adopted by init ;)
– Rany Albeg Wein
Apr 22 '13 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 '13 at 22:49
add a comment |
Try runningpstreeto see if the child ( your background process ) was adopted by init ;)
– Rany Albeg Wein
Apr 22 '13 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 '13 at 22:49
Try running
pstree to see if the child ( your background process ) was adopted by init ;)– Rany Albeg Wein
Apr 22 '13 at 19:07
Try running
pstree to see if the child ( your background process ) was adopted by init ;)– Rany Albeg Wein
Apr 22 '13 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 '13 at 22:49
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 '13 at 22:49
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f73338%2fstarting-resque-worker-with-script-doesnt-work-starting-by-hand-does%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
add a comment |
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.
add a comment |
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.
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.
answered Apr 23 '13 at 4:58
DannyDanny
19117
19117
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f73338%2fstarting-resque-worker-with-script-doesnt-work-starting-by-hand-does%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try running
pstreeto see if the child ( your background process ) was adopted by init ;)– Rany Albeg Wein
Apr 22 '13 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 '13 at 22:49