kstats-node 1.0.4 → 1.0.5

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.
@@ -0,0 +1,69 @@
1
+ #!/bin/bash
2
+ #
3
+ # Launch kstats-node as a service. Log everything into a log file, create a pid file used to start/stop the service.
4
+ #
5
+ #
6
+
7
+ COMMAND="$1"
8
+ shift 1
9
+
10
+ while getopts p:l:c: o
11
+ do
12
+ case "$o" in
13
+ p)
14
+ PIDFILE="$OPTARG";;
15
+ l)
16
+ LOGFILE="$OPTARG";;
17
+ c)
18
+ CONFIG="$OPTARG";;
19
+ [?])
20
+ echo >&2 "Usage: kstats-node-service [start|stop|restart|force-reload] -p pidfile -l logfile -c configfile"
21
+ exit 1;;
22
+ esac
23
+ done
24
+
25
+ if [[ -z "$LOGFILE" || -z "PIDFILE" || -z "$CONFIG" ]]; then
26
+ echo >&2 "Usage: kstats-node-service [start|stop|restart|force-reload] -p pidfile -l logfile -c configfile"
27
+ exit 1
28
+ fi
29
+
30
+ case "$COMMAND" in
31
+ start)
32
+ if [[ -e "$PIDFILE" ]]; then
33
+ echo "'$PIDFILE' already exists. Try to stop running kstats-node first"
34
+ exit 1
35
+ fi
36
+
37
+ echo "Start kstats-node..."
38
+ (kstats-node --config $CONFIG > $LOGFILE 2>&1)&
39
+ echo $! > $PIDFILE
40
+ echo "kstats-node started."
41
+ ;;
42
+ stop)
43
+ echo "Stop kstats-node..."
44
+ if [[ -e "$PIDFILE" ]]; then
45
+ kill `cat $PIDFILE`
46
+ rm $PIDFILE
47
+ echo "kstats-node stopped."
48
+ else
49
+ echo "Nothing to stop."
50
+ exit 1
51
+ fi
52
+ ;;
53
+ restart|force-reload)
54
+ echo "Restart kstats-node..."
55
+ if [[ -e "$PIDFILE" ]]; then
56
+ kill `cat $PIDFILE`
57
+ rm $PIDFILE
58
+ fi
59
+ (kstats-node --config $CONFIG > $LOGFILE 2>&1)&
60
+ echo $! > $PIDFILE
61
+ echo "kstats-node restarted."
62
+ ;;
63
+ *)
64
+ echo >&2 "Usage: kstats-node-service [start|stop|restart|force-reload] -p pidfile -l logfile -c configfile"
65
+ exit 1
66
+ ;;
67
+ esac
68
+
69
+ exit 0
@@ -1,69 +1,2 @@
1
- #!/bin/bash
2
- #
3
- # Launch kstats-node as a service. Log everything into a log file, create a pid file used to start/stop the service.
4
- #
5
- #
6
-
7
- COMMAND="$1" #start/stop/restart
8
- shift 1
9
-
10
- while getopts p:l:c: o
11
- do
12
- case "$o" in
13
- p)
14
- PIDFILE="$OPTARG";;
15
- l)
16
- LOGFILE="$OPTARG";;
17
- c)
18
- CONFIG="$OPTARG";;
19
- [?])
20
- echo >&2 "Usage: $0 [start|stop|restart|force-reload] -p pidfile -l logfile -c configfile"
21
- exit 1;;
22
- esac
23
- done
24
-
25
- if [[ -z "$LOGFILE" || -z "PIDFILE" || -z "$CONFIG" ]]; then
26
- echo >&2 "Usage: $0 [start|stop|restart|force-reload] -p pidfile -l logfile -c configfile"
27
- exit 1
28
- fi
29
-
30
- case "$COMMAND" in
31
- start)
32
- if [[ -e "$PIDFILE" ]]; then
33
- echo "'$PIDFILE' already exists. Try to stop running kstats-node first"
34
- exit 1
35
- fi
36
-
37
- echo "Start kstats-node..."
38
- (kstats-node --config $CONFIG > $LOGFILE 2>&1)&
39
- echo $! > $PIDFILE
40
- echo "kstats-node started."
41
- ;;
42
- stop)
43
- echo "Stop kstats-node..."
44
- if [[ -e "$PIDFILE" ]]; then
45
- kill `cat $PIDFILE`
46
- rm $PIDFILE
47
- echo "kstats-node stopped."
48
- else
49
- echo "Nothing to stop."
50
- exit 1
51
- fi
52
- ;;
53
- restart|force-reload)
54
- echo "Restart kstats-node..."
55
- if [[ -e "$PIDFILE" ]]; then
56
- kill `cat $PIDFILE`
57
- rm $PIDFILE
58
- fi
59
- (kstats-node --config $CONFIG > $LOGFILE 2>&1)&
60
- echo $! > $PIDFILE
61
- echo "kstats-node restarted."
62
- ;;
63
- *)
64
- echo >&2 "Usage: $0 [start|stop|restart|force-reload] -p pidfile -l logfile -c configfile"
65
- exit 1
66
- ;;
67
- esac
68
-
69
- exit 0
1
+ #!/usr/bin/env ruby
2
+ exec(File.expand_path("../_kstats-node-service.sh", __FILE__), *ARGV)
@@ -1,5 +1,5 @@
1
1
  module Kstats
2
2
  module Node
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kstats-node
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -80,6 +80,7 @@ description: Provide a simple way to make probe on system values, and monitoring
80
80
  email:
81
81
  - yacine@kosmogo.com
82
82
  executables:
83
+ - _kstats-node-service.sh
83
84
  - kstats-node
84
85
  - kstats-node-service
85
86
  extensions: []
@@ -90,6 +91,7 @@ files:
90
91
  - LICENSE.txt
91
92
  - README.md
92
93
  - Rakefile
94
+ - bin/_kstats-node-service.sh
93
95
  - bin/kstats-node
94
96
  - bin/kstats-node-service
95
97
  - kstats-node.gemspec