Browse Source

Gentoo: Automatic crash detection and restart

Norman Rieß 9 years ago
parent
commit
de736c0aa8
2 changed files with 25 additions and 0 deletions
  1. 19 0
      contrib/gentoo/README.md
  2. 6 0
      contrib/gentoo/service_restart.sh

+ 19 - 0
contrib/gentoo/README.md

@@ -0,0 +1,19 @@
+# Gentoo
+
+## Automatic crash detection and restart
+
+Copy the the openrc init script from `contrib/openrc` to `/etc/init.d/` and modify the `CONFFILE` and `command` parameter to your needs. 
+Then start cjdns by issuing
+
+    /etc/init.d/cjdns start
+
+Configure the init system to autostart cjdns
+
+    rc-update add cjdns default
+
+Copy the service_restart script `contrib/gentoo/service_restart.sh` to any convenient directory on 
+your system and modify the eMail address. If you do not wish to be notified, comment out the whole line.
+Now add an crontab entry like this
+
+    # Restart crashed Services
+    * * * * *       root	/path/to/script/service_restart.sh

+ 6 - 0
contrib/gentoo/service_restart.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+for svc in $(rc-status --crashed); do
+	rc-service $svc -- --nodeps restart
+	echo "$svc has crashed and has been restarted." | mail -s "$svc has been restarted." <your_email>
+done