unicorn-ctl 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/README.md +5 -5
  3. data/bin/unicornctl +26 -0
  4. metadata +1 -1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## UnicornCtl Changelog
2
2
 
3
+ ### 0.1.1 / 2013-09-11
4
+
5
+ * Added `reopen-logs` command.
6
+
3
7
  ### 0.1.0 / 2013-09-11
4
8
 
5
9
  * Initial open-source release of unicornctl.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## unicornctl - unicorn/rainbows control script
2
2
 
3
- `unicornctl` is a simple and easy to use console tool for managing ruby applications using unicorn or
4
- rainbows application server. The tool provides a set of reliable commands to start/stop/restart
5
- unicorn instances or upgrade them without or with minimal downtime. `unicornctl` script could easily
6
- be used as a base for a startup script for unix operating systems (see examples directory for a
7
- Redhat-style startup script example).
3
+ `unicornctl` is a simple and easy to use console tool for managing ruby applications using
4
+ [unicorn](http://unicorn.bogomips.org/) or [rainbows](http://rainbows.rubyforge.org/) application servers.
5
+ The tool provides a set of reliable commands to start/stop/restart unicorn instances or upgrade them
6
+ without or with minimal downtime. `unicornctl` script could easily be used as a base for a startup
7
+ script for unix operating systems (see examples directory for a Redhat-style startup script example).
8
8
 
9
9
  Please note, that this is still an alpha-quality software and it could have many issues. If you try it and
10
10
  find any problems, feel free to report them using [Github Issues page](https://github.com/swiftype/unicorn-ctl/issues).
data/bin/unicornctl CHANGED
@@ -13,6 +13,7 @@ VALID_COMMANDS = %w[
13
13
  restart
14
14
  force-restart
15
15
  upgrade
16
+ reopen-logs
16
17
  ]
17
18
 
18
19
  #---------------------------------------------------------------------------------------------------
@@ -353,6 +354,28 @@ def upgrade_application!(options)
353
354
  puts "OK: Upgrade is done successfully!"
354
355
  end
355
356
 
357
+ #---------------------------------------------------------------------------------------------------
358
+ def reopen_logs!(options)
359
+ # Check pid file
360
+ pid_file = unicorn_pid_file(options)
361
+ unless File.exists?(pid_file)
362
+ puts "OK: The process is not running"
363
+ exit(0)
364
+ end
365
+
366
+ pid = read_pid(pid_file)
367
+ if pid_running?(pid)
368
+ puts "Sending USR1 signal to process with pid=#{pid}..."
369
+ send_signal('USR1', pid)
370
+ else
371
+ puts "WARNING: Slate pid file found, removing it: #{pid_file}"
372
+ FileUtils.rm(pid_file)
373
+ end
374
+
375
+ puts "Done!"
376
+ exit(0)
377
+ end
378
+
356
379
  #---------------------------------------------------------------------------------------------------
357
380
  def show_help(error = nil)
358
381
  puts "ERROR: #{error}\n\n" if error
@@ -475,6 +498,9 @@ case command
475
498
  when 'upgrade'
476
499
  upgrade_application!(options)
477
500
 
501
+ when 'reopen-logs'
502
+ reopen_logs!(options)
503
+
478
504
  else
479
505
  show_help("ERROR: Invalid command: #{command}")
480
506
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn-ctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: