]> git.openstreetmap.org Git - chef.git/commitdiff
Convert supybot service to a systemd unit
authorTom Hughes <tom@compton.nu>
Sun, 26 Feb 2017 10:55:02 +0000 (10:55 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 26 Feb 2017 11:00:04 +0000 (11:00 +0000)
cookbooks/supybot/metadata.rb
cookbooks/supybot/recipes/default.rb
cookbooks/supybot/templates/default/supybot.init.erb [deleted file]

index ee6d1c4630949023c9538c889246c7a6082d97b1..6c22755c53a03ff57849985ca627743be2796f25 100644 (file)
@@ -5,3 +5,4 @@ license           "Apache 2.0"
 description       "Installs and configures supybot"
 long_description  IO.read(File.join(File.dirname(__FILE__), "README.md"))
 version           "1.0.0"
+depends           "systemd"
index 7f9953526084e2bd9ae64033d3a30425dd539527..551f713315c38d8fd56bee4a946253827e65269d 100644 (file)
@@ -123,16 +123,21 @@ git "/usr/local/lib/supybot/plugins/Git" do
   group "root"
 end
 
-template "/etc/init.d/supybot" do
-  source "supybot.init.erb"
-  owner "root"
-  group "root"
-  mode 0o755
+systemd_service "supybot" do
+  description "OpenStreetMap IRC Robot"
+  after "network.target"
+  user "supybot"
+  exec_start "/usr/bin/supybot /etc/supybot/supybot.conf"
+  private_tmp true
+  private_devices true
+  protect_system true
+  protect_home true
+  no_new_privileges true
+  restart "on-failure"
 end
 
 service "supybot" do
   action [:enable, :start]
-  supports :restart => true
   subscribes :restart, "template[/etc/supybot/supybot.conf]"
   subscribes :restart, "template[/etc/supybot/channels.conf]"
   subscribes :restart, "template[/etc/supybot/git.conf]"
@@ -140,5 +145,5 @@ service "supybot" do
   subscribes :restart, "template[/etc/supybot/userdata.conf]"
   subscribes :restart, "template[/etc/supybot/users.conf]"
   subscribes :restart, "git[/usr/local/lib/supybot/plugins/Git]"
-  subscribes :restart, "template[/etc/init.d/supybot]"
+  subscribes :restart, "systemd_service[supybot]"
 end
diff --git a/cookbooks/supybot/templates/default/supybot.init.erb b/cookbooks/supybot/templates/default/supybot.init.erb
deleted file mode 100644 (file)
index 8fb6d6b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-start() {
-  start-stop-daemon --start --chuid supybot --background --make-pidfile --pidfile /var/run/supybot.pid --exec /usr/bin/supybot -- /etc/supybot/supybot.conf
-}
-
-stop() {
-  start-stop-daemon --stop --retry TERM/15/KILL/30 --pidfile /var/run/supybot.pid
-}
-
-case "$1" in
-  start)
-    start
-    ;;
-  stop)
-    stop
-    ;;
-  restart)
-    stop || exit $?
-    start
-    ;;
-esac