chrisrec 0.1.0

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 (41) hide show
  1. data/Manifest +39 -0
  2. data/README +0 -0
  3. data/Rakefile +15 -0
  4. data/chrisrec.gemspec +30 -0
  5. data/lib/backgroundrb/backgroundrb.rb +22 -0
  6. data/lib/chrisrec.rb +12 -0
  7. data/lib/console/console.rb +19 -0
  8. data/lib/daemon/daemon.rb +134 -0
  9. data/lib/gitosis/gitosis.rb +131 -0
  10. data/lib/memcached/memcached.rb +140 -0
  11. data/lib/munin/munin.rb +135 -0
  12. data/lib/mysql/mysql.rake +95 -0
  13. data/lib/mysql/mysql.rb +51 -0
  14. data/lib/rake/rake.rb +19 -0
  15. data/lib/rakecron/rakecron.rb +35 -0
  16. data/lib/starling/starling.rb +124 -0
  17. data/lib/tomcat/tomcat.rb +200 -0
  18. data/lib/workling/workling.rb +72 -0
  19. data/template/daemon/daemon-init-script.erb +59 -0
  20. data/template/daemon/monit.conf.erb +4 -0
  21. data/template/memcached/memcached-conf.erb +1 -0
  22. data/template/memcached/memcached.erb +59 -0
  23. data/template/memcached/monit.conf.erb +8 -0
  24. data/template/memcached/start-memcached.erb +118 -0
  25. data/template/munin/httpd-vhost-munin.conf.erb +20 -0
  26. data/template/munin/munin.conf.erb +70 -0
  27. data/template/munin/munin_nginx_vhost.conf.erb +24 -0
  28. data/template/rakecron/rakecron.erb +12 -0
  29. data/template/starling/monit.conf.erb +14 -0
  30. data/template/starling/starling-init-script.erb +69 -0
  31. data/template/tomcat/conf/server.xml.erb +33 -0
  32. data/template/tomcat/conf/web.xml +1194 -0
  33. data/template/tomcat/logs/empty.txt +1 -0
  34. data/template/tomcat/monit.conf.erb +8 -0
  35. data/template/tomcat/temp/empty.txt +1 -0
  36. data/template/tomcat/tomcat.erb +28 -0
  37. data/template/tomcat/webapps/empty.txt +1 -0
  38. data/template/tomcat/work/empty.txt +1 -0
  39. data/template/workling/monit.conf.erb +4 -0
  40. data/template/workling/workling-init-script.erb +56 -0
  41. metadata +121 -0
@@ -0,0 +1,72 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :chrisrec do
3
+ namespace :workling do
4
+
5
+ set :local_template_dir, "#{File.dirname(__FILE__)}/../../template"
6
+
7
+ SYSTEM_CONFIG_FILES[:workling] = [
8
+ {:template => 'workling-init-script.erb',
9
+ :path => 'workling/etc/init.d/workling',
10
+ :mode => 0755,
11
+ :owner => 'root:root'},
12
+
13
+ {:template => 'monit.conf.erb',
14
+ :path => "workling/etc/monit.d/monit_workling.conf",
15
+ :mode => 0600,
16
+ :owner => 'root:root'}
17
+ ]
18
+
19
+ # Generating Configuration Files
20
+ desc "Generate configuration file(s) for workling from template(s)"
21
+ task :config_gen do
22
+ SYSTEM_CONFIG_FILES[:workling].each do |file|
23
+ deprec2.render_template(:workling, file)
24
+ end
25
+ end
26
+
27
+ desc 'Deploy configuration files(s) for workling'
28
+ task :config, :roles => :app do
29
+ deprec2.push_configs(:workling, SYSTEM_CONFIG_FILES[:workling])
30
+ symlink_init_d
31
+ symlink_monit_d
32
+
33
+ activate
34
+ end
35
+
36
+ desc "Stop workling"
37
+ task :stop , :roles => :app do
38
+ sudo "/etc/init.d/workling_#{starling_port} stop"
39
+ end
40
+
41
+ desc "Start workling"
42
+ task :start , :roles => :app do
43
+ sudo "/etc/init.d/workling_#{starling_port} start"
44
+ end
45
+
46
+ desc "Start the workling server"
47
+ task :restart, :roles => :app do
48
+ stop
49
+ sleep(2)
50
+ start
51
+ end
52
+
53
+ task :activate, :roles => :app do
54
+ send(run_method, "update-rc.d workling_#{starling_port} defaults")
55
+ end
56
+
57
+ task :deactivate, :roles => :app do
58
+ send(run_method, "update-rc.d -f workling_#{starling_port} remove")
59
+ end
60
+
61
+
62
+ task :symlink_init_d do
63
+ sudo "ln -fs #{deploy_to}/workling/workling/etc/init.d/workling /etc/init.d/workling_#{starling_port}"
64
+ end
65
+
66
+ task :symlink_monit_d do
67
+ sudo "ln -fs #{deploy_to}/workling/workling/etc/monit.d/monit_workling.conf /etc/monit.d/monit_workling_#{starling_port}.conf"
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,59 @@
1
+ #! /bin/sh
2
+ #
3
+ ### BEGIN INIT INFO
4
+ # Provides: defaultdaemon
5
+ # Required-Start: $remote_fs $syslog
6
+ # Required-Stop: $remote_fs $syslog
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: Start daemon at boot time
10
+ # Description: Enable service provided by daemon.
11
+ ### END INIT INFO
12
+
13
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14
+ DAEMON=<%=deploy_to%>/current/<%=daemon%>
15
+ NAME=<%=daemon_name%>
16
+ DESC=<%=daemon_name%>
17
+ PIDFILE=<%=deploy_to%>/current/tmp/pids/<%=daemon_pid%>
18
+
19
+ test -x $DAEMON || exit 0
20
+
21
+ set -e
22
+
23
+ case "$1" in
24
+ start)
25
+ echo -n "Starting $DESC: "
26
+ cd <%=deploy_to%>/current && PATH=/opt/ruby-enterprise/bin:$PATH DAEMON_ENV=<%=daemon_env%> $DAEMON start
27
+ echo "$NAME."
28
+ ;;
29
+ stop)
30
+ echo -n "Stopping $DESC: "
31
+ # cd <%=deploy_to%>/current && PATH=/opt/ruby-enterprise/bin:$PATH DAEMON_ENV=<%=daemon_env%> $DAEMON stop
32
+ echo "$NAME."
33
+ [ -f $PIDFILE ] && kill -9 `tail $PIDFILE`
34
+ rm -f $PIDFILE
35
+ ;;
36
+
37
+ restart|force-reload)
38
+ #
39
+ # If the "reload" option is implemented, move the "force-reload"
40
+ # option to the "reload" entry above. If not, "force-reload" is
41
+ # just the same as "restart".
42
+ #
43
+ echo -n "Restarting $DESC: "
44
+ # cd <%=deploy_to%>/current && PATH=/opt/ruby-enterprise/bin:$PATH RAILS_ENV=<%=rails_env%> $DAEMON stop
45
+ sleep 1
46
+ [ -f $PIDFILE ] && kill -9 `tail $PIDFILE`
47
+ rm -f $PIDFILE
48
+ cd <%=deploy_to%>/current && PATH=/opt/ruby-enterprise/bin:$PATH RAILS_ENV=<%=daemon_env%> $DAEMON start
49
+ echo "$NAME."
50
+ ;;
51
+ *)
52
+ N=/etc/init.d/$NAME
53
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
54
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
55
+ exit 1
56
+ ;;
57
+ esac
58
+
59
+ exit 0
@@ -0,0 +1,4 @@
1
+ check process <%=daemon_name%> with pidfile <%=deploy_to%>/current/tmp/pids/<%=daemon_pid%>
2
+ group <%=daemon_name%>
3
+ start program = "/etc/init.d/<%=daemon_name%> start"
4
+ stop program = "/etc/init.d/<%=daemon_name%> stop"
@@ -0,0 +1 @@
1
+ -u <%= memcached_user %> -m <%=memcache_memory%> -l <%= memcached_address %> -p <%= memcached_port %>
@@ -0,0 +1,59 @@
1
+ #! /bin/sh
2
+ #
3
+ ### BEGIN INIT INFO
4
+ # Provides: defaultdaemon
5
+ # Required-Start: $remote_fs $syslog
6
+ # Required-Stop: $remote_fs $syslog
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: Start daemon at boot time
10
+ # Description: Enable service provided by daemon.
11
+ ### END INIT INFO
12
+
13
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14
+ DAEMON=/usr/local/bin/memcached
15
+ DAEMONBOOTSTRAP=<%=deploy_to%>/memcached/memcached/etc/init.d/start-memcached
16
+ NAME=memcached
17
+ DESC=memcached
18
+ PIDFILE=<%=memcached_run_dir%>/memcached_<%=memcached_port%>.pid
19
+
20
+ test -x $DAEMON || exit 0
21
+ test -x $DAEMONBOOTSTRAP || exit 0
22
+
23
+ set -e
24
+
25
+ case "$1" in
26
+ start)
27
+ echo -n "Starting $DESC: "
28
+ start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
29
+ echo "$NAME."
30
+ ;;
31
+ stop)
32
+ echo -n "Stopping $DESC: "
33
+ start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
34
+ echo "$NAME."
35
+ rm -f $PIDFILE
36
+ ;;
37
+
38
+ restart|force-reload)
39
+ #
40
+ # If the "reload" option is implemented, move the "force-reload"
41
+ # option to the "reload" entry above. If not, "force-reload" is
42
+ # just the same as "restart".
43
+ #
44
+ echo -n "Restarting $DESC: "
45
+ start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
46
+ rm -f $PIDFILE
47
+ sleep 1
48
+ start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
49
+ echo "$NAME."
50
+ ;;
51
+ *)
52
+ N=/etc/init.d/$NAME
53
+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
54
+ echo "Usage: $N {start|stop|restart|force-reload}" >&2
55
+ exit 1
56
+ ;;
57
+ esac
58
+
59
+ exit 0
@@ -0,0 +1,8 @@
1
+ check process memcached_<%= memcached_port %> with pidfile <%= memcached_run_dir %>/memcached_<%= memcached_port %>.pid
2
+ group memcached_<%= memcached_port %>
3
+ start program = "/etc/init.d/memcached_<%= memcached_port %> start"
4
+ stop program = "/etc/init.d/memcached_<%= memcached_port %> stop"
5
+
6
+ if failed host <%= memcached_address %> port <%= memcached_port %>
7
+ with timeout 10 seconds
8
+ then alert
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/perl -w
2
+
3
+ # start-memcached
4
+ # 2003/2004 - Jay Bonci <jaybonci@debian.org>
5
+ # This script handles the parsing of the /etc/memcached.conf file
6
+ # and was originally created for the Debian distribution.
7
+ # Anyone may use this little script under the same terms as
8
+ # memcached itself.
9
+
10
+ use strict;
11
+
12
+ if($> != 0 and $< != 0)
13
+ {
14
+ print STDERR "Only root wants to run start-memcached.\n";
15
+ exit;
16
+ }
17
+
18
+ my $params; my $etchandle; my $etcfile = "<%=deploy_to%>/memcached/memcached/etc/init.d/memcached.conf";
19
+
20
+ # This script assumes that memcached is located at /usr/bin/memcached, and
21
+ # that the pidfile is writable at /var/run/memcached.pid
22
+
23
+ my $memcached = "/usr/local/bin/memcached";
24
+ my $pidfile = "<%=memcached_run_dir%>/memcached_<%=memcached_port%>.pid";
25
+
26
+ # If we don't get a valid logfile parameter in the /etc/memcached.conf file,
27
+ # we'll just throw away all of our in-daemon output. We need to re-tie it so
28
+ # that non-bash shells will not hang on logout. Thanks to Michael Renner for
29
+ # the tip
30
+ # my $fd_reopened = "/dev/null";
31
+ my $fd_reopened = "<%=memcached_log_dir%>/memcached_<%=memcached_port%>.log";
32
+
33
+ sub handle_logfile
34
+ {
35
+ my ($logfile) = @_;
36
+ $fd_reopened = $logfile;
37
+ }
38
+
39
+ sub reopen_logfile
40
+ {
41
+ my ($logfile) = @_;
42
+
43
+ open *STDERR, ">>$logfile";
44
+ open *STDOUT, ">>$logfile";
45
+ open *STDIN, ">>/dev/null";
46
+ $fd_reopened = $logfile;
47
+ }
48
+
49
+ # This is set up in place here to support other non -[a-z] directives
50
+
51
+ my $conf_directives = {
52
+ "logfile" => \&handle_logfile,
53
+ };
54
+
55
+ if(open $etchandle, $etcfile)
56
+ {
57
+ foreach my $line (<$etchandle>)
58
+ {
59
+ $line ||= "";
60
+ $line =~ s/\#.*//g;
61
+ $line =~ s/\s+$//g;
62
+ $line =~ s/^\s+//g;
63
+ next unless $line;
64
+ next if $line =~ /^\-[dh]/;
65
+
66
+ if($line =~ /^[^\-]/)
67
+ {
68
+ my ($directive, $arg) = $line =~ /^(.*?)\s+(.*)/;
69
+ $conf_directives->{$directive}->($arg);
70
+ next;
71
+ }
72
+
73
+ push @$params, $line;
74
+ }
75
+
76
+ }else{
77
+ $params = [];
78
+ }
79
+
80
+ push @$params, "-u root" unless(grep "-u", @$params);
81
+ $params = join " ", @$params;
82
+
83
+ if(-e $pidfile)
84
+ {
85
+ open PIDHANDLE, "$pidfile";
86
+ my $localpid = <PIDHANDLE>;
87
+ close PIDHANDLE;
88
+
89
+ chomp $localpid;
90
+ if(-d "/proc/$localpid")
91
+ {
92
+ print STDERR "memcached is already running.\n";
93
+ exit;
94
+ }else{
95
+ `rm -f $localpid`;
96
+ }
97
+
98
+ }
99
+
100
+ my $pid = fork();
101
+
102
+ if($pid == 0)
103
+ {
104
+ reopen_logfile($fd_reopened);
105
+ exec "$memcached $params";
106
+ exit(0);
107
+
108
+ }else{
109
+ if(open PIDHANDLE,">$pidfile")
110
+ {
111
+ print PIDHANDLE $pid;
112
+ close PIDHANDLE;
113
+ }else{
114
+
115
+ print STDERR "Can't write pidfile to $pidfile.\n";
116
+ }
117
+ }
118
+
@@ -0,0 +1,20 @@
1
+ Listen 2813
2
+ <VirtualHost *:2813>
3
+ ServerName <%= domain %>
4
+
5
+ DocumentRoot <%= "#{deploy_to}/munin/html" %>
6
+
7
+ <Directory <%= "#{deploy_to}/munin/html" %>>
8
+ Options FollowSymLinks
9
+ AllowOverride None
10
+ Order allow,deny
11
+ Allow from all
12
+ AuthName "Munin Access"
13
+ AuthType Basic
14
+ AuthUserFile <%= "#{deploy_to}/munin/htpasswd.users"%>
15
+ Require valid-user
16
+ </Directory>
17
+
18
+ ErrorLog /var/log/munin-error_log
19
+ CustomLog /var/log/munin-access_log combined
20
+ </VirtualHost>
@@ -0,0 +1,70 @@
1
+ # Example configuration file for Munin, generated by 'make build'
2
+
3
+ # The next three variables specifies where the location of the RRD
4
+ # databases, the HTML output, and the logs, severally. They all
5
+ # must be writable by the user running munin-cron.
6
+ dbdir /var/lib/munin
7
+ htmldir <%= deploy_to %>/munin/html
8
+ logdir /var/log/munin
9
+ rundir /var/run/munin
10
+
11
+ # Where to look for the HTML templates
12
+ tmpldir /etc/munin/templates
13
+
14
+ # Make graphs show values per minute instead of per second
15
+ #graph_period minute
16
+
17
+ # Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
18
+ # something changes (OK -> WARNING, CRITICAL -> OK, etc)
19
+ #contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
20
+ #contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
21
+ #
22
+ # For those with Nagios, the following might come in handy. In addition,
23
+ # the services must be defined in the Nagios server as well.
24
+ #contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
25
+
26
+ # a simple host tree
27
+ [localhost.localdomain]
28
+ address 127.0.0.1
29
+ use_node_name yes
30
+
31
+ #
32
+ # A more complex example of a host tree
33
+ #
34
+ ## First our "normal" host.
35
+ # [fii.foo.com]
36
+ # address foo
37
+ #
38
+ ## Then our other host...
39
+ # [fay.foo.com]
40
+ # address fay
41
+ #
42
+ ## Then we want totals...
43
+ # [foo.com;Totals] #Force it into the "foo.com"-domain...
44
+ # update no # Turn off data-fetching for this "host".
45
+ #
46
+ # # The graph "load1". We want to see the loads of both machines...
47
+ # # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
48
+ # load1.graph_title Loads side by side
49
+ # load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
50
+ #
51
+ # # The graph "load2". Now we want them stacked on top of each other.
52
+ # load2.graph_title Loads on top of each other
53
+ # load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
54
+ # load2.dummy_field.draw AREA # We want area instead the default LINE2.
55
+ # load2.dummy_field.label dummy # This is needed. Silly, really.
56
+ #
57
+ # # The graph "load3". Now we want them summarised into one field
58
+ # load3.graph_title Loads summarised
59
+ # load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
60
+ # load3.combined_loads.label Combined loads # Must be set, as this is
61
+ # # not a dummy field!
62
+ #
63
+ ## ...and on a side note, I want them listen in another order (default is
64
+ ## alphabetically)
65
+ #
66
+ # # Since [foo.com] would be interpreted as a host in the domain "com", we
67
+ # # specify that this is a domain by adding a semicolon.
68
+ # [foo.com;]
69
+ # node_order Totals fii.foo.com fay.foo.com
70
+ #
@@ -0,0 +1,24 @@
1
+ server {
2
+ listen 2813;
3
+ server_name <%= domain %>;
4
+ root <%= deploy_to %>/munin/html;
5
+ access_log <%= deploy_to %>/shared/log/munin-access.log;
6
+ error_log <%= deploy_to %>/shared/log/munin-error.log;
7
+
8
+ location / {
9
+ # auth_basic "Munin Access";
10
+ # auth_basic_user_file <%= "#{deploy_to}/munin/htpasswd.users"%>;
11
+
12
+ proxy_set_header X-Real-IP $remote_addr;
13
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14
+ proxy_set_header Host $http_host;
15
+ proxy_redirect false;
16
+
17
+ if (-f $request_filename/index.html) {
18
+ rewrite (.*) $1/index.html break;
19
+ }
20
+ if (-f $request_filename.html) {
21
+ rewrite (.*) $1.html break;
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,12 @@
1
+ PATH=/usr/local/bin:/usr/bin:/bin:/opt/ruby-enterprise/bin
2
+
3
+ ## every 30 minutes
4
+ ## 1,31 * * * * root sh -c 'cd <%=deploy_to%>/current/; rake RAKETASK RAILS_ENV=<%=rails_env%> >> <%=rakecron_log_dir%>/<%=application%>-TASK.log 2>&1'
5
+ ## every day at 4am
6
+ ## 1 4 * * * root sh -c 'cd <%=deploy_to%>/current/; rake RAKETASK RAILS_ENV=<%=rails_env%> >> <%=rakecron_log_dir%>/<%=application%>-TASK.log 2>&1'
7
+ ## every day at 4am (except sundays)
8
+ ## 1 4 * * 1-6 root sh -c 'cd <%=deploy_to%>/current/; rake RAKETASK RAILS_ENV=<%=rails_env%> >> <%=rakecron_log_dir%>/<%=application%>-TASK.log 2>&1'
9
+ ## on a sunday
10
+ ## 1 4 * * 7 root sh -c 'cd <%=deploy_to%>/current/; rake RAKETASK RAILS_ENV=<%=rails_env%> >> <%=rakecron_log_dir%>/<%=application%>-TASK.log 2>&1'
11
+ ## every 3 minutes
12
+ ## */3 * * * * root sh -c 'cd <%=deploy_to%>/current/; rake RAKETASK RAILS_ENV=<%=rails_env%> >> <%=rakecron_log_dir%>/<%=application%>-TASK.log 2>&1'
@@ -0,0 +1,14 @@
1
+ check process starling_<%= starling_port %> with pidfile <%= starling_run_dir %>/starling_<%= starling_port %>.pid
2
+ group starling_<%= starling_port %>
3
+ start program = "/etc/init.d/starling_<%= starling_port %> start"
4
+ stop program = "/etc/init.d/starling_<%= starling_port %> stop"
5
+
6
+ if failed host <%= starling_address %> port <%= starling_port %>
7
+ with timeout 10 seconds
8
+ then alert
9
+
10
+ if totalmem > 100 Mb then restart
11
+ if cpu > 60% for 2 cycles then alert
12
+ if cpu > 80% for 5 cycles then restart
13
+ if loadavg(5min) > 10 for 8 cycles then restart
14
+ if 3 restarts within 5 cycles then timeout
@@ -0,0 +1,69 @@
1
+ #! /bin/sh
2
+ ### BEGIN INIT INFO
3
+ # Provides: starling
4
+ # Required-Start: $local_fs $remote_fs
5
+ # Required-Stop: $local_fs $remote_fs
6
+ # Default-Start: 2 3 4 5
7
+ # Default-Stop: S 0 1 6
8
+ # Short-Description: Starling queue server
9
+ # Description: The Starling distributed, transactional queue server
10
+ ### END INIT INFO
11
+ # Author:
12
+ # Version:
13
+
14
+ set -e
15
+
16
+ LOGFILE=<%= starling_log_dir %>/starling_<%= starling_port %>.log
17
+ SPOOLDIR=<%= starling_spool_dir %>
18
+ PORT=<%= starling_port %>
19
+ LISTEN=<%= starling_address %>
20
+ PIDFILE=<%= starling_run_dir %>/starling_<%= starling_port %>.pid
21
+
22
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
23
+ NAME=starling
24
+ DESC="Starling"
25
+ INSTALL_DIR=/usr/local/bin
26
+ DAEMON=$INSTALL_DIR/$NAME
27
+ SCRIPTNAME=/etc/init.d/$NAME
28
+ OPTS="-h $LISTEN -p $PORT -d -q $SPOOLDIR -P $PIDFILE -L $LOGFILE"
29
+
30
+ . /lib/lsb/init-functions
31
+
32
+
33
+ # Gracefully exit if the package has been removed.
34
+ test -x $DAEMON || exit 0
35
+
36
+ d_start() {
37
+ log_begin_msg "Starting Starling Server..."
38
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
39
+ -- $OPTS || log_end_msg 1
40
+ log_end_msg 0
41
+ }
42
+
43
+ d_stop() {
44
+ log_begin_msg "Stopping Starling Server..."
45
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
46
+ || log_end_msg 1
47
+ log_end_msg 0
48
+ }
49
+
50
+ case "$1" in
51
+ start)
52
+ d_start
53
+ ;;
54
+ stop)
55
+ d_stop
56
+ ;;
57
+ restart|force-reload|reload)
58
+ d_stop
59
+ sleep 2
60
+ d_start
61
+ ;;
62
+ *)
63
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
64
+ exit 3
65
+ ;;
66
+ esac
67
+
68
+ exit 0
69
+
@@ -0,0 +1,33 @@
1
+ <Server port="<%=tomcat_shutdown_port%>" shutdown="TOMCAT_<%=tomcat_port%>_SHUTDOWN" debug="0">
2
+
3
+ <Service name="Catalina">
4
+
5
+ <Connector port="<%=tomcat_port%>"
6
+ maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
7
+ enableLookups="false" redirectPort="<%=tomcat_ssl_port%>" acceptCount="100"
8
+ debug="0" connectionTimeout="20000"
9
+ disableUploadTimeout="true" />
10
+
11
+ <Engine name="Catalina" defaultHost="localhost" debug="0">
12
+
13
+ <Logger className="org.apache.catalina.logger.FileLogger"
14
+ prefix="catalina_log." suffix=".txt"
15
+ timestamp="true"/>
16
+
17
+ <Host name="localhost" debug="0" appBase="webapps"
18
+ unpackWARs="true" autoDeploy="true"
19
+ xmlValidation="false" xmlNamespaceAware="false">
20
+
21
+ <Logger className="org.apache.catalina.logger.FileLogger"
22
+ directory="logs" prefix="localhost_log." suffix=".txt"
23
+ timestamp="true"/>
24
+
25
+ <Context path="" docBase="<%=tomcat_war%>" debug="0"/>
26
+
27
+ </Host>
28
+
29
+ </Engine>
30
+
31
+ </Service>
32
+
33
+ </Server>