kostya / eye

Process monitoring tool. Inspired from Bluepill and God.
MIT License
1.19k stars 89 forks source link

Define working directory for each process. #236

Closed emanzx closed 4 years ago

emanzx commented 4 years ago

Can I define separate working_dir for specific process? or specific environment for each process?

Eye.application 'services' do
  check :cpu, every: 10.seconds, below: 100, times: 3 # global check for all processes

    working_dir "/root/"
    stdall "/var/log/dnsvault/eye/trash.log" # stdout,err logs for processes by default
    env 'APP_ENV' => 'development' # global env for each processes
    trigger :flapping, times: 10, within: 1.minute, retry_in: 5.minutes
    chain grace: 10.seconds # chained start-restart with 10s interval, one by one.

    process :nginx do
       pid_file "/var/run/nginx.pid"
       start_command "service nginx start"
       stop_command "service nginx stop"
       restart_command "service nginx restart"
       stdall "/var/log/dnsvault/eye/nginx.log"
       start_timeout 60.seconds
       depend_on [:tincd, :avahi_autoipd, :avahi_daemon]
    end
    process :redis do
       pid_file "/var/run/redis/redis.pid"
       start_command "service redis start"
       stop_command "service redis stop"
       restart_command "service redis restart"
       stdall "/var/log/dnsvault/eye/redis.log"
       start_timeout 60.seconds
    end
    process :syncthing do
       working_dir "/usr/home/system/"
       uid "system"
       gid "system"
       pid_file "/var/run/syncthing.pid"
       start_command "/usr/home/syncthing/syncthing"
       stdall "/var/log/dnsvault/eye/syncthing.log"
       start_timeout 60.seconds
       daemonize true
    end
end
kostya commented 4 years ago

yes, just copy option working_dir or any other into process definition. it would be rewrited for that process.