aboutsummaryrefslogtreecommitdiff
path: root/buildtools/debian-skeleton/rpki-ca.upstart
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools/debian-skeleton/rpki-ca.upstart')
-rw-r--r--buildtools/debian-skeleton/rpki-ca.upstart53
1 files changed, 53 insertions, 0 deletions
diff --git a/buildtools/debian-skeleton/rpki-ca.upstart b/buildtools/debian-skeleton/rpki-ca.upstart
new file mode 100644
index 00000000..36a792ee
--- /dev/null
+++ b/buildtools/debian-skeleton/rpki-ca.upstart
@@ -0,0 +1,53 @@
+# RPKI CA Service
+
+description "RPKI CA Servers"
+author "Rob Austein <sra@hactrn.net>"
+
+# This is almost certainly wrong. Suggestions on how to improve this
+# welcome, but please first read the Python code to understand what it
+# is doing.
+
+# Our only real dependencies are on mysqld and our config file.
+
+start on started mysql
+stop on stopping mysql
+
+pre-start script
+ if test -f /etc/rpki.conf &&
+ test -f /usr/share/rpki/ca.cer &&
+ test -f /usr/share/rpki/irbe.cer &&
+ test -f /usr/share/rpki/irdbd.cer &&
+ test -f /usr/share/rpki/rpkid.cer &&
+ test -f /usr/share/rpki/rpkid.key
+ then
+ install -m 755 -o rpkid -g rpkid -d /var/run/rpki /usr/share/rpki/publication
+
+ # This should be running as user rpkid, but I haven't got all
+ # the pesky details worked out yet. Most testing to date has
+ # either been all under a single non-root user or everything
+ # as root, so, eg, running "rpkic initialize" as root will not
+ # leave things in a sane state for rpkid running as user
+ # rpkid.
+ #
+ # In the interest of debugging the rest of this before trying
+ # to break new ground, run daemons as root for the moment,
+ # with the intention of coming back to fix this later.
+ #
+ #sudo -u rpkid /usr/sbin/rpki-start-servers
+ /usr/sbin/rpki-start-servers
+
+ else
+ stop
+ exit 0
+ fi
+end script
+
+post-stop script
+ for i in rpkid pubd irdbd rootd
+ do
+ if test -f /var/run/rpki/$i.pid
+ then
+ kill `cat /var/run/rpki/$i.pid`
+ fi
+ done
+end script