Module: Bridgetown::Utils::PidTracker

Included in:
Commands::Start, Aux
Defined in:
bridgetown-core/lib/bridgetown-core/utils/pid_tracker.rb

Instance Method Summary collapse

Instance Method Details

#add_pid(pid, file:) ⇒ Object



10
11
12
# File 'bridgetown-core/lib/bridgetown-core/utils/pid_tracker.rb', line 10

def add_pid(pid, file:)
  File.write pidfile_for(file), "#{pid}\n", mode: "a+"
end

#create_pid_dirObject



6
7
8
# File 'bridgetown-core/lib/bridgetown-core/utils/pid_tracker.rb', line 6

def create_pid_dir
  FileUtils.mkdir_p pids_dir
end

#read_pidfile(file) ⇒ Object



14
15
16
# File 'bridgetown-core/lib/bridgetown-core/utils/pid_tracker.rb', line 14

def read_pidfile(file)
  File.readlines pidfile_for(file), chomp: true
end

#remove_pidfile(file) ⇒ Object



18
19
20
# File 'bridgetown-core/lib/bridgetown-core/utils/pid_tracker.rb', line 18

def remove_pidfile(file)
  File.delete pidfile_for(file)
end