From f578431c0b279b436c5a537d6a61802d475690d7 Mon Sep 17 00:00:00 2001 From: Daigo Moriwaki Date: Sun, 26 Aug 2018 09:14:48 +0900 Subject: [PATCH] [shogi-server] Create a directory for a PID file. (Closes #38546) To put a PID file such as /var/run/shogi-server/shogi-server.pid, if directories do not exist, they will be created recursively. --- changelog | 4 ++++ shogi-server | 3 +++ 2 files changed, 7 insertions(+) diff --git a/changelog b/changelog index b3df157..600d5a4 100644 --- a/changelog +++ b/changelog @@ -4,6 +4,10 @@ A file named "STOP" in the base directory prevents the server from starting new games including Floodgate matches. (Closes #38544) + * [shogi-server] Create a directory for a PID file. + To put a PID file such as /var/run/shogi-server/shogi-server.pid, if + directories do not exist, they will be created recursively. + (Closes #38546) 2018-04-07 Daigo Moriwaki diff --git a/shogi-server b/shogi-server index 21bc9d1..f1cfbb3 100755 --- a/shogi-server +++ b/shogi-server @@ -34,6 +34,7 @@ require 'shogi_server' require 'shogi_server/config' require 'shogi_server/util' require 'shogi_server/league/floodgate_thread.rb' +require 'pathname' require 'tempfile' ################################################# @@ -271,6 +272,8 @@ def check_command_line if $options["pid-file"] $options["pid-file"] = File.expand_path($options["pid-file"], $topdir) + path = Pathname.new($options["pid-file"]) + path.dirname().mkpath() unless ShogiServer::is_writable_file? $options["pid-file"] usage $stderr.puts "Can not create the pid file: %s" % [$options["pid-file"]] -- 2.11.0