-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Daemonize #35
Comments
The --restart option makes filewatcher run the command supplied as a parameter in the background:
Every time an html file changes, filewatcher will kill the webserver process and start it again in a new process. So if you want to run filewatcher in the background, you can actually supply filewatcher as a command to filewatcher itself. I haven't tested this, but it may look something like this:
If you wan't to get some hints on how to run things in the background, please have a look at https://github.com/thomasfl/filewatcher/blob/master/bin/filewatcher Processes are run in the background simply by using
I have to admit I am not sure what you are trying to accomplish. |
Okay, that's example for my case: #!/usr/bin/env ruby
def bash(command)
system "bash -c \"#{command}\""
end
def server(command)
pumactl = "pumactl #{command} -F config/puma.rb"
bash pumactl
return unless %i(start restart).include?(command) && environment == 'development'
bash 'pkill -f filewatcher'
bash "filewatcher '**/*.{rb,ru,yml}' '#{pumactl}' > /dev/null &"
end
def monitor_server
bash "tail -f log/{stdout,stderr} -q"
end
## Runtime
case ARGV[0]
when 'start'
server :start
when 'stop'
server :stop
when 'restart'
server :restart
when 'monitor'
monitor_server
when 'devel'
server :restart
puts 'Waiting for logs...'
sleep 2
monitor_server
end |
Processes without daemonizing binds to Ruby script, as I think (also with |
Maybe that can be some helpful for your gem? |
Hello!
How can I run
filewatcher
in background?My case:
When I press Ctrl+C in
tail
—filewatcher
is also stopping.I want to stop
tail
, but notfilewatcher
.Thanks!
The text was updated successfully, but these errors were encountered: