Yuri Kanivetsky
2017-Oct-13 19:04 UTC
[CentOS] sidekiq receives SIGHUP when started via ssh -t
Hi, I have a couple of ideas how to fix it, but I'm trying to figure out what's going on first. I mainly start this program (sidekiq) on Debian systems, and it might be my first time running it under CentOS, so my conjecture is that it has to do with differences between distributions... Now then, when I run it this way: ssh user at example.com '. ~/.bash_profile && rvm 2.3.1 at gemset1 && cd path/to/site && bundle exec sidekiq -C config/sidekiq.yml -d -L log/sidekiq.log' it daemonizes itself and stays running. When I add -t switch (ssh -t ...), it gets terminated by SIGHUP. On Ubuntu it stays running in both cases. What's happening here? Any suggestions are welcome. Regards, Yuri
Yuri Kanivetsky
2017-Oct-16 17:23 UTC
[CentOS] sidekiq receives SIGHUP when started via ssh -t
Hi, I was able to narrow it down to this ruby script: #!/usr/bin/env ruby Process.daemon while true sleep 1 end And I can reproduce it on one particular CentOS server, on the other CentOS server it works as on Ubuntu. The CentOS server where I can reproduce the issue is supposed to have vanilla CentOS, but probably not exactly. So, when I run it this way on CentOS 7: ssh user at example.com -t '. ~/.bash_profile && rvm 2.3.1 && cd 1 && ./1.rb' script doesn't stay, without -t it does. Under Ubuntu 16.04 it stays in both cases. I tried to reproduce it with bash: #!/usr/bin/env bash (setsid bash -c 'exec > /dev/null 2>&1 < /dev/null; while true; do sleep 1 done') & But it behaves consistently across servers (with -t terminates on any server I tried, without -t stays). I might be missing something here. Any ideas are welcome. Like, what to check? Where and what to ask? Regards, Yuri
Yuri Kanivetsky
2017-Oct-18 23:15 UTC
[CentOS] sidekiq receives SIGHUP when started via ssh -t
Hi, I've just found the reason. From what I can see, on the server the process received SIGHUP right after fork. It had no time to switch to new session and detach from controlling terminal. And to work around that one might add sleep to the end: ssh user at example.com -t '. ~/.bash_profile && rvm 2.3.1 && cd 1 && ./1.rb && sleep 1' or wait for pid file to be created, whatever. Regards, Yuri
Seemingly Similar Threads
- sidekiq receives SIGHUP when started via ssh -t
- Question about RVM installation; where to find .bashrc and/or .bash_profile files?
- RVM on a Macbook
- rails server being aborted due to mysql lib file not available
- [SOLVED] [OT] OSX-10.9.3 cd ~'/ problem with spaces'