Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
27cc3de6
Commit
27cc3de6
authored
Sep 04, 2009
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 475403: A RHEL SysV Init Script for jobqueue.pl
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
parent
ccaf82a2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
208 additions
and
1 deletion
+208
-1
Runner.pm
Bugzilla/JobQueue/Runner.pm
+80
-0
bugzilla-queue
contrib/bugzilla-queue
+109
-0
jobqueue.pl
jobqueue.pl
+19
-1
No files found.
Bugzilla/JobQueue/Runner.pm
View file @
27cc3de6
...
...
@@ -27,7 +27,9 @@
package
Bugzilla::JobQueue::
Runner
;
use
strict
;
use
Cwd
qw(abs_path)
;
use
File::
Basename
;
use
File::
Copy
;
use
Pod::
Usage
;
use
Bugzilla::
Constants
;
...
...
@@ -37,6 +39,11 @@ BEGIN { eval "use base qw(Daemon::Generic)"; }
our
$VERSION
=
BUGZILLA_VERSION
;
# Info we need to install/uninstall the daemon on RHEL/Fedora.
our
$chkconfig
=
"/sbin/chkconfig"
;
our
$initd
=
"/etc/init.d"
;
our
$initscript
=
"bugzilla-queue"
;
# The Daemon::Generic docs say that it uses all sorts of
# things from gd_preconfig, but in fact it does not. The
# only thing it uses from gd_preconfig is the "pidfile"
...
...
@@ -92,6 +99,79 @@ sub gd_usage {
return
0
}
sub
gd_can_install
{
my
$self
=
shift
;
my
$source_file
=
"contrib/$initscript"
;
my
$dest_file
=
"$initd/$initscript"
;
my
$sysconfig
=
'/etc/sysconfig'
;
my
$config_file
=
"$sysconfig/$initscript"
;
if
(
!-
x
$chkconfig
or
!-
d
$initd
)
{
return
$self
->
SUPER::
gd_can_install
(
@_
);
}
return
sub
{
if
(
!-
w
$initd
)
{
print
"You must run the 'install' command as root.\n"
;
return
;
}
if
(
-
e
$dest_file
)
{
print
"$initscript already in $initd.\n"
;
}
else
{
copy
(
$source_file
,
$dest_file
)
or
die
"Could not copy $source_file to $dest_file: $!"
;
chmod
(
0755
,
$dest_file
)
or
die
"Could not change permissions on $dest_file: $!"
;
}
system
(
$chkconfig
,
'--add'
,
$initscript
);
print
"$initscript installed."
,
" To start the daemon, do \"$dest_file start\" as root.\n"
;
if
(
-
d
$sysconfig
and
-
w
$sysconfig
)
{
if
(
-
e
$config_file
)
{
print
"$config_file already exists.\n"
;
return
;
}
open
(
my
$config_fh
,
">"
,
$config_file
)
or
die
"Could not write to $config_file: $!"
;
my
$directory
=
abs_path
(
dirname
(
$self
->
{
_original_zero
}));
my
$owner_id
=
(
stat
$self
->
{
_original_zero
})[
4
];
my
$owner
=
getpwuid
(
$owner_id
);
print
$config_fh
<<END;
#!/bin/sh
BUGZILLA="$directory"
USER=$owner
END
close
(
$config_fh
);
}
else
{
print
"Please edit $dest_file to configure the daemon.\n"
;
}
}
}
sub
gd_can_uninstall
{
my
$self
=
shift
;
if
(
-
x
$chkconfig
and
-
d
$initd
)
{
return
sub
{
if
(
!-
e
"$initd/$initscript"
)
{
print
"$initscript not installed.\n"
;
return
;
}
system
(
$chkconfig
,
'--del'
,
$initscript
);
print
"$initscript disabled."
,
" To stop it, run: $initd/$initscript stop\n"
;
}
}
return
$self
->
SUPER::
gd_can_install
(
@_
);
}
sub
gd_check
{
my
$self
=
shift
;
...
...
contrib/bugzilla-queue
0 → 100644
View file @
27cc3de6
#!/bin/bash
#
# bugzilla-queue This starts, stops, and restarts the Bugzilla jobqueue.pl
# daemon, which manages sending queued mail and possibly
# other queued tasks in the future.
#
# chkconfig: 345 85 15
# description: Bugzilla queue runner
#
### BEGIN INIT INFO
# Provides: bugzilla-queue
# Required-Start: $local_fs $syslog MTA mysqld
# Required-Stop: $local_fs $syslog MTA mysqld
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Start and stop the Bugzilla queue runner.
# Description: The Bugzilla queue runner (jobqueue.pl) sends any mail
# that Bugzilla has queued to be sent in the background. If you
# have enabled the use_mailer_queue parameter in Bugzilla, you
# must run this daemon.
### END INIT INFO
NAME
=
`
basename
$0
`
#################
# Configuration #
#################
# This should be the path to your Bugzilla
BUGZILLA
=
/var/www/html/bugzilla
# Who owns the Bugzilla directory and files?
USER
=
root
# If you want to pass any options to the daemon (like -d for debugging)
# specify it here.
OPTIONS
=
""
# You can also override the configuration by creating a
# /etc/sysconfig/bugzilla-queue file so that you don't
# have to edit this script.
if
[
-r
/etc/sysconfig/
$NAME
]
;
then
.
/etc/sysconfig/
$NAME
fi
##########
# Script #
##########
RETVAL
=
0
BIN
=
$BUGZILLA
/jobqueue.pl
PIDFILE
=
/var/run/
$NAME
.pid
# Source function library.
.
/etc/rc.d/init.d/functions
usage
()
{
echo
"Usage: service
$NAME
{start|stop|status|restart|condrestart}"
RETVAL
=
1
}
start
()
{
if
[
-f
"
$PIDFILE
"
]
;
then
checkpid
`
cat
$PIDFILE
`
&&
return
0
fi
echo
-n
"Starting
$NAME
: "
touch
$PIDFILE
chown
$USER
$PIDFILE
daemon
--user
=
$USER
\
"
$BIN
${
OPTIONS
}
-p '
$PIDFILE
' -n
$NAME
start > /dev/null"
ret
=
$?
[
$ret
-eq
"0"
]
&&
touch
/var/lock/subsys/
$NAME
echo
return
$ret
}
stop
()
{
[
-f
/var/lock/subsys/
$NAME
]
||
return
0
echo
-n
"Killing
$NAME
: "
killproc
$NAME
echo
rm
-f
/var/lock/subsys/
$NAME
}
restart
()
{
stop
start
}
condrestart
()
{
[
-e
/var/lock/subsys/
$NAME
]
&&
restart
||
return
0
}
case
"
$1
"
in
start
)
start
;
RETVAL
=
$?
;;
stop
)
stop
;
RETVAL
=
$?
;;
status
)
$BIN
-p
$PIDFILE
-n
$NAME
check
;
RETVAL
=
$?
;;
restart
)
restart
;
RETVAL
=
$?
;;
condrestart
)
condrestart
;
RETVAL
=
$?
;;
*
)
usage
;
RETVAL
=
2
;;
esac
exit
$RETVAL
jobqueue.pl
View file @
27cc3de6
...
...
@@ -37,7 +37,7 @@ jobqueue.pl - Runs jobs in the background for Bugzilla.
=
head1
SYNOPSIS
./
jobqueue
.
pl
[
OPTION
]
{
start
|
stop
|
restart
|
check
|
help
|
version
}
./
jobqueue
.
pl
[
OPTION
S
]
COMMAND
OPTIONS:
-
f
Run
in
the
foreground
(
don
't detach)
...
...
@@ -53,9 +53,27 @@ jobqueue.pl - Runs jobs in the background for Bugzilla.
restart
Stops
a
running
jobqueue
if
one
is
running
,
and
then
starts
a
new
one
.
check
Report
the
current
status
of
the
daemon
.
install
On
some
*
nix
systems
,
this
automatically
installs
and
configures
jobqueue
.
pl
as
a
system
service
so
that
it
will
start
every
time
the
machine
boots
.
uninstall
Removes
the
system
service
for
jobqueue
.
pl
.
help
Display
this
usage
info
version
Display
the
version
of
jobqueue
.
pl
=
head1
DESCRIPTION
See
L
<
Bugzilla::
JobQueue
>
and
L
<
Bugzilla::JobQueue::
Runner
>.
=
head1
Running
jobqueue
.
pl
as
a
System
Service
For
systems
that
use
Upstart
or
SysV
Init
,
there
is
a
SysV
/
Upstart
init
script
included
with
Bugzilla
for
jobqueue
.
pl:
F
<
contrib
/
bugzilla
-
queue
>.
It
should
work
out
-
of
-
the
-
box
on
RHEL
,
Fedora
,
CentOS
etc
.
You
can
install
it
by
doing
C
<./
jobqueue
.
pl
install
>
as
root
,
after
already
having
run
L
<
checksetup
>
at
least
once
to
completion
on
this
Bugzilla
installation
.
If
you
are
using
a
system
that
isn
'
t
RHEL
,
Fedora
,
CentOS
,
etc
.
,
then
you
may
have
to
modify
F
<
contrib
/
bugzilla
-
queue
>
and
install
it
yourself
manually
in
order
to
get
C
<
jobqueue
.
pl
>
running
as
a
system
service
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment