home · contact · privacy
Set up htwtxt restart reminder.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 30 Mar 2016 00:10:03 +0000 (02:10 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 30 Mar 2016 00:10:03 +0000 (02:10 +0200)
bin/simplemail_out.sh [new file with mode: 0755]
bin/start_htwtxt.sh [new file with mode: 0755]
jessie_postinstall.sh
mails/htwtxt_restart [new file with mode: 0644]
systemfiles/htwtxt_restart_reminder.service [new file with mode: 0644]

diff --git a/bin/simplemail_out.sh b/bin/simplemail_out.sh
new file mode 100755 (executable)
index 0000000..8340944
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+#
+# This mails to plom@plomlompom.com the message in the file named by the first
+# parameter, decoded with the first line as subject and everything below the
+# second line as the message body.
+
+subject=`head -1 $1`
+body=`tail -n +3 $1`
+echo "$body" | mutt -s "$subject" plom@plomlompom.com
diff --git a/bin/start_htwtxt.sh b/bin/start_htwtxt.sh
new file mode 100755 (executable)
index 0000000..14b6a7e
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+htwtxt \
+    --contact 'see http://www.plomlompom.de/' \
+    --mailport 587 \
+    --mailserver smtp.gmail.com \
+    --mailuser christian.heller@gmail.com \
+    --port 80 \
+    --signup
index 76a75f6cd266a8dfc39b7edbb1cb625bd0fd9cd4..5305c14b78fb08879615d668077cef2586df03f9 100755 (executable)
@@ -227,6 +227,9 @@ if [ "$1" = "server" ]; then
         path=`su - plom -c 'echo $GOPATH/bin/htwtxt'`
         setcap 'cap_net_bind_service=+ep' $path
         su - plom -c 'mkdir -p ~/htwtxt'
+        cp config/systemfiles/htwtxt_restart_reminder.service \
+            /etc/systemd/system/htwtxt_restart_reminder.service
+        systemctl enable /etc/systemd/system/htwtxt_restart_reminder.service
     fi
 
 elif [ "$1" = "thinkpad" ]; then
diff --git a/mails/htwtxt_restart b/mails/htwtxt_restart
new file mode 100644 (file)
index 0000000..8247df9
--- /dev/null
@@ -0,0 +1,5 @@
+[SYSADMIN] [HTWTXT] Restart reminder
+
+The virtual server hosting the htwtxt server was restarted, so the htwtxt server
+itself needs to be restarted too, via (in screen) its
+~/config/bin/start_htwtxt.sh.
diff --git a/systemfiles/htwtxt_restart_reminder.service b/systemfiles/htwtxt_restart_reminder.service
new file mode 100644 (file)
index 0000000..e8e240d
--- /dev/null
@@ -0,0 +1,12 @@
+# /etc/systemd/system/weechat.service
+
+[Unit]
+Description=htwtxt restart reminder
+
+[Service]
+Type=forking
+User=plom
+ExecStart=/bin/sh -c '~/config/bin/simplemail_out.sh ~/config/mail/htwtxt_restart'
+
+[Install]
+WantedBy=multi-user.target