Nohup & Sass: Process keeps running but, after a while, *.scss files do not get compiled

nohupprocessterminal

I am using Sass on a CentOS 5.8 server and want it to keep running after SSH logout, so that other users can edit *.scss files for days or even weeks to come without any need to start the program each time they login (in fact, they don't even have SSH access).

I have used the following command from this question/answer:

$ nohup sass –watch path/to/scss/files:path/to/css/output/files &

Then, I log out of the SSH session and the process keeps running. It all works fine (logging in again and using touch to create a test file (test.scss) correctly triggers the creation of the corresponding test.css file) for the first few minutes, but after a while the *.scss files stop getting compiled… However,

$ ps aux | grep 'sass'

Shows that the process is still running.

Anybody knows what am I doing wrong?

EDIT: this is the output I'm getting from nohup.out:

/usr/local/rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/yaml.rb:56:in `':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
>>> Sass is watching for changes. Press Ctrl-C to stop.
>>> New template detected: 
/home/*/sites/all/themes/test.scss
  overwrite private_html/sites/all/themes//test.css
>>> Deleted template detected: 
/home/*/sites/all/themes/test.scss

The YAML-related error seems unrelated to the problem as Sass is working correctly for a short while. It just silently stops working at some point even though the process remains running…

Best Answer

Ugh sounds like an annoying problem. Doubtful an issue with nohup since it's widely used, mature and simple. Let's eliminate it anyway. We're also eliminating the backgrounding of the process as an issue too.

Open a screen... literally screen

run your command without nohup, but lets log it somewhere

sass --watch path/to/scss/files:path/to/css/output/files 2>&1 | tee sass.log

the 2>&1 makes sure we grab STDERR and STDOUT, while tee forks a log to disk

now detach your screen: ctrl+a d

logout, log back in and see if that makes a difference. No need to reattach to your screen since you have the sass.log going but you would do that with screen -r.

Related Question