timshadel-starling 0.9.8.20080924 → 0.9.8.200810061510

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,7 @@
1
1
  == 0.9.9
2
2
  * remove dependency on SyslogLogger so that starling works on windows.
3
+ * fix config file loading so relative paths are expanded properly <jacob@jacobatzen.dk>
4
+ * clean up redhat init.d script <gaffneyc@gmail.com>
3
5
 
4
6
  == 0.9.8
5
7
  * add fix to enable relative paths <david@motorator.com>
data/etc/starling.redhat CHANGED
@@ -1,63 +1,66 @@
1
1
  #!/bin/bash
2
2
  #
3
+ # Make sure the /var/run/starling, /var/log/starling and /var/spool/starling
4
+ # all exist and are owned by starling:starling
5
+ #
3
6
  # starling This shell script takes care of starting and stopping
4
7
  # the starling server
5
8
  # chkconfig: 345 98 98
6
9
  # description: The starling queue server
10
+ # processname: starling
11
+ # pidfile: /var/run/starling/starling.pid
12
+ # logfile: /var/log/starling/starling.log
13
+
14
+ # Source function library.
15
+ . /etc/rc.d/init.d/functions
16
+
17
+ # Source networking configuration.
18
+ [ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
19
+
20
+ DUSER=starling
21
+ DGROUP=starling
22
+ LOGFILE=/var/log/starling/starling.log
23
+ SPOOLDIR=/var/spool/starling
24
+ PORT=22122
25
+ LISTEN=0.0.0.0
26
+ PIDFILE=/var/run/starling/starling.pid
7
27
 
8
- #determine where the 'pidof' executable is located
9
- if [ -e /bin/pidof ]; then
10
- PIDOF="/bin/pidof"
11
- elif [ -e /sbin/pidof ]; then
12
- PIDOF="/sbin/pidof"
13
- elif [ -e /usr/local/bin/pidof ]; then
14
- PIDOF="/usr/local/bin/pidof"
15
- elif [ -e /bin/pgrep ]; then
16
- PIDOF="/bin/pgrep"
17
- elif [ -e /usr/bin/pgrep ]; then
18
- PIDOF="/usr/bin/pgrep"
19
- elif [ -e /usr/local/bin/pgrep ]; then
20
- PIDOF="/usr/local/bin/pgrep"
21
- else
22
- echo "Could not find pidof or pgrep"
23
- fi
24
-
25
- PROGDIR="/usr/bin"
26
- PROGNAME="starling"
27
- OPTIONS="-u nobody -g nobody -L /var/log/starling.log -q /var/spool/starling"
28
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
29
+ NAME=starling
30
+ INSTALL_DIR=/usr/local/bin
31
+ DAEMON=$INSTALL_DIR/$NAME
32
+ OPTS="-h $LISTEN -p $PORT -d -q $SPOOLDIR -P $PIDFILE -L $LOGFILE -u $DUSER -g $DGROUP"
28
33
 
29
34
  start() {
30
- pid=`$PIDOF $PROGNAME`
31
- if [ "$pid" != "" ]; then
32
- echo "$PROGDIR$PROGNAME already running: $pid"
33
- else
34
- echo "Starting $PROGDIR$PROGNAME"
35
- cd $PROGDIR
36
- nohup $PROGDIR$PROGNAME $OPTIONS &
37
- fi
35
+ echo -n $"Starting starling: "
36
+
37
+ daemon --pidfile=$PIDFILE $DAEMON $OPTS
38
+ echo
38
39
  }
39
40
 
40
41
  stop() {
41
- pid=`$PIDOF $PROGNAME`
42
- if [ "$pid" != "" ]; then
43
- echo "Stopping $PROGDIR$PROGNAME: $pid"
44
- kill $pid
45
- else
46
- echo "$PROGDIR$PROGNAME not running"
47
- fi
42
+ echo -n $"Stopping starling: "
43
+
44
+ killproc -p $PIDFILE starling
45
+ echo
48
46
  }
49
47
 
50
48
  case "$1" in
51
- start)
52
- start
53
- ;;
54
- stop)
55
- stop
56
- ;;
57
- restart)
58
- stop
59
- sleep 3
60
- start
61
- ;;
62
-
49
+ start)
50
+ start
51
+ ;;
52
+ stop)
53
+ stop
54
+ ;;
55
+ restart)
56
+ stop
57
+ sleep 3
58
+ start
59
+ ;;
60
+ status)
61
+ status -p $PIDFILE starling
62
+ ;;
63
+ *)
64
+ echo $"Usage: $0 {start|stop|restart|status}"
65
+ exit 1
63
66
  esac
@@ -143,8 +143,7 @@ STAT queue_%s_age %d\r\n".freeze
143
143
  private
144
144
 
145
145
  def delete(queue)
146
- @queue_collection.queues(queue).close
147
- @queue_collection.queues.delete(queue)
146
+ @queue_collection.delete(queue)
148
147
  respond DELETE_RESPONSE
149
148
  end
150
149
 
@@ -83,6 +83,11 @@ module StarlingServer
83
83
  @trx = nil
84
84
  @not_trx.close
85
85
  end
86
+
87
+ def purge
88
+ close
89
+ File.delete(log_path)
90
+ end
86
91
 
87
92
  private
88
93
 
@@ -59,6 +59,12 @@ module StarlingServer
59
59
  @stats[:current_bytes] -= result.size
60
60
  result
61
61
  end
62
+
63
+ def delete(key)
64
+ queue = @queues.delete(key)
65
+ return if queue.nil?
66
+ queue.purge
67
+ end
62
68
 
63
69
  ##
64
70
  # Returns all active queues.
@@ -40,6 +40,11 @@ module StarlingServer
40
40
  when "queue_path" then key = "path"
41
41
  when "log_file" then key = "logger"
42
42
  end
43
+
44
+ if %w(logger path pid_file).include?(key)
45
+ value = File.expand_path(value)
46
+ end
47
+
43
48
  options[key.to_sym] = value
44
49
 
45
50
  if options[:log_level].instance_of?(String)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timshadel-starling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8.20080924
4
+ version: 0.9.8.200810061510
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blaine Cook
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2008-08-13 00:00:00 -07:00
16
+ date: 2008-10-08 00:00:00 -07:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency