pmux-gw 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@
2
2
  pmux_path: "pmux"
3
3
  bind_address: "0.0.0.0"
4
4
  bind_port: 18080
5
+ pidfile: "/var/run/pmux-gw.pid"
5
6
  user: "admin"
6
7
  group: "admin"
7
8
  glusterfs_root: "/mnt"
@@ -8,6 +8,7 @@ module Pmux
8
8
  class Application
9
9
  def initialize
10
10
  @config_file_path = "/etc/pmux-gw/pmux-gw.conf"
11
+ @pidfile = "/var/run/pmux-gw.pid"
11
12
  @foreground = false
12
13
  @reload = false
13
14
  @term = false
@@ -138,6 +139,10 @@ module Pmux
138
139
 
139
140
  # コンフィグの読み込み
140
141
  load_config()
142
+
143
+ # pidfile作成
144
+ @pidfile = $config["pidfile"] if $config["pidfile"]
145
+ open(@pidfile, 'w') {|f| f << Process.pid } if @pidfile
141
146
 
142
147
  # ユーザーとグループの情報を取得する
143
148
  user = Etc.getpwnam($config["user"])
@@ -1,5 +1,5 @@
1
1
  module Pmux
2
2
  module Gateway
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
4
4
  end
5
5
  end
data/rpm/Makefile CHANGED
@@ -13,6 +13,7 @@ rpmbuild: clean
13
13
  mkdir -p SPECS
14
14
  mkdir -p INSTALL
15
15
  cp ../pkg/pmux-gw-*.gem SOURCES/
16
+ cp pmux-gw SOURCES/
16
17
  rpmbuild -ba --define "_topdir $(TOP_DIR)" --define "_ruby_verid \"$(RUBY_VERID)\"" pmux-gw.spec
17
18
 
18
19
  clean:
data/rpm/pmux-gw ADDED
@@ -0,0 +1,111 @@
1
+ #!/bin/bash
2
+ #
3
+ # pmux-gw Pmux gateway
4
+ #
5
+ # chkconfig: - 85 15
6
+ # description: Pmux gateway.
7
+ # processname: pmux-gw
8
+ # config: /etc/sysconfig/pmux-gw
9
+ # pidfile: /var/run/pmux-gw.pid
10
+ #
11
+ ### BEGIN INIT INFO
12
+ # Provides: pmux-gw
13
+ # Required-Start: $local_fs $remote_fs $network
14
+ # Required-Stop: $local_fs $remote_fs $network
15
+ # Short-Description: start and stop the pmux-gw daemon
16
+ # Description: The pmux-gw daemon allows access to Subversion
17
+ # repositories using the svn network protocol.
18
+ ### END INIT INFO
19
+
20
+ # Source function library.
21
+ . /etc/rc.d/init.d/functions
22
+
23
+ if [ -f /etc/sysconfig/pmux-gw ]; then
24
+ . /etc/sysconfig/pmux-gw
25
+ fi
26
+
27
+ prog=pmux-gw
28
+ exec=${PMUX_LOGVIEW-/usr/local/bin/pmux-gw}
29
+ config=${CONFIG-/etc/pmux-gw/pmux-gw.conf}
30
+ user=${USER-root}
31
+ pidfile=${PIDFILE-/var/run/pmux-gw.pid}
32
+ lockfile=${LOCKFILE-/var/lock/subsys/pmux-gw}
33
+ [ -e /etc/sysconfig/${prog} ] && . /etc/sysconfig/${prog}
34
+
35
+ lockfile=/var/lock/subsys/${prog}
36
+
37
+ start() {
38
+ [ -x ${exec} ] || exit 5
39
+ [ -f ${config} ] || exit 6
40
+ echo -n $"Starting ${prog}: "
41
+ daemon --pidfile=${pidfile} --user=${user} $exec -c ${config}
42
+ retval=$?
43
+ echo
44
+ if [ ${retval} -eq 0 ]; then
45
+ touch ${lockfile} || retval=4
46
+ fi
47
+ return ${retval}
48
+ }
49
+
50
+ stop() {
51
+ echo -n $"Stopping ${prog}: "
52
+ killproc -p ${pidfile} ${prog}
53
+ retval=$?
54
+ echo
55
+ [ ${retval} -eq 0 ] && rm -f ${lockfile}
56
+ return ${retval}
57
+ }
58
+
59
+ restart() {
60
+ stop
61
+ start
62
+ }
63
+
64
+ reload() {
65
+ restart
66
+ }
67
+
68
+ force_reload() {
69
+ restart
70
+ }
71
+
72
+ rh_status() {
73
+ # run checks to determine if the service is running or use generic status
74
+ status -p ${pidfile} ${prog}
75
+ }
76
+
77
+ rh_status_q() {
78
+ rh_status >/dev/null 2>&1
79
+ }
80
+
81
+ case "$1" in
82
+ start)
83
+ rh_status_q && exit 0
84
+ $1
85
+ ;;
86
+ stop)
87
+ rh_status_q || exit 0
88
+ $1
89
+ ;;
90
+ restart)
91
+ $1
92
+ ;;
93
+ reload)
94
+ rh_status_q || exit 7
95
+ $1
96
+ ;;
97
+ force-reload)
98
+ force_reload
99
+ ;;
100
+ status)
101
+ rh_status
102
+ ;;
103
+ condrestart|try-restart)
104
+ rh_status_q || exit 0
105
+ restart
106
+ ;;
107
+ *)
108
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
109
+ exit 2
110
+ esac
111
+ exit $?
data/rpm/pmux-gw.spec CHANGED
@@ -5,7 +5,7 @@
5
5
  %define ruby_verid %{_ruby_verid}
6
6
  %endif
7
7
  %define rbname pmux-gw
8
- %define version 0.1.8
8
+ %define version 0.1.9
9
9
  %define release 1
10
10
 
11
11
  Summary: Pmux gateway server
@@ -17,6 +17,7 @@ Group: Development/Ruby
17
17
  License: Distributable
18
18
  URL: https://github.com/iij/pmux-gw
19
19
  Source0: %{rbname}-%{version}.gem
20
+ Source1: %{rbname}
20
21
  BuildRoot: %{_tmppath}/%{name}-%{version}-root
21
22
  Requires: ruby
22
23
  Requires: rubygems%(echo -n %{ruby_verid}) >= 1.3.7
@@ -50,6 +51,8 @@ gem%{ruby_verid} install --local --install-dir %{gembuilddir} --force %{SOURCE0}
50
51
  mkdir -p %{buildroot}/%{_bindir}
51
52
  mv %{gembuilddir}/bin/* %{buildroot}/%{_bindir}
52
53
  rmdir %{gembuilddir}/bin
54
+ mkdir -p %{buildroot}/etc/init.d
55
+ cp %{SOURCE1} %{buildroot}/etc/init.d/
53
56
 
54
57
  %clean
55
58
  %{__rm} -rf %{buildroot}
@@ -93,7 +96,9 @@ rmdir %{gembuilddir}/bin
93
96
  %{gemdir}/gems/%{rbname}-%{version}/examples/pmux-gw.conf
94
97
  %{gemdir}/gems/%{rbname}-%{version}/examples/password
95
98
  %{gemdir}/gems/%{rbname}-%{version}/rpm/pmux-gw.spec
99
+ %{gemdir}/gems/%{rbname}-%{version}/rpm/pmux-gw
96
100
  %{gemdir}/gems/%{rbname}-%{version}/rpm/Makefile
101
+ %attr(0755,root,root) /etc/init.d/%{rbname}
97
102
 
98
103
  %doc %{gemdir}/doc/%{rbname}-%{version}
99
104
  %{gemdir}/cache/%{rbname}-%{version}.gem
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pmux-gw
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hiroyuki Kakine
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-03-05 00:00:00 +09:00
18
+ date: 2013-03-07 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -174,6 +174,7 @@ files:
174
174
  - examples/pmux-gw.conf
175
175
  - rpm/Makefile
176
176
  - rpm/pmux-gw.spec
177
+ - rpm/pmux-gw
177
178
  has_rdoc: true
178
179
  homepage: https://github.com/iij/pmux-gw
179
180
  licenses: []