Module: Bridgetown::Foundation::Packages::PidTracker
- Defined in:
- bridgetown-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb
Instance Method Summary collapse
-
#add_pid(pid, file:) ⇒ Object
-
#create_pid_dir ⇒ Object
-
#read_pidfile(file) ⇒ Object
-
#remove_pidfile(file) ⇒ Object
Instance Method Details
#add_pid(pid, file:) ⇒ Object
10 11 12 |
# File 'bridgetown-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb', line 10 def add_pid(pid, file:) File.write pidfile_for(file), "#{pid}\n", mode: "a+" end |
#create_pid_dir ⇒ Object
6 7 8 |
# File 'bridgetown-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb', line 6 def create_pid_dir FileUtils.mkdir_p pids_dir end |
#read_pidfile(file) ⇒ Object
14 15 16 |
# File 'bridgetown-foundation/lib/bridgetown/foundation/packages/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-foundation/lib/bridgetown/foundation/packages/pid_tracker.rb', line 18 def remove_pidfile(file) File.delete pidfile_for(file) end |