From: Christian Heller Date: Wed, 30 Mar 2016 00:10:03 +0000 (+0200) Subject: Set up htwtxt restart reminder. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/day?a=commitdiff_plain;h=0618514bef4ecff4a69bf5312dd7a75073be0859;p=config Set up htwtxt restart reminder. --- diff --git a/bin/simplemail_out.sh b/bin/simplemail_out.sh new file mode 100755 index 0000000..8340944 --- /dev/null +++ b/bin/simplemail_out.sh @@ -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 index 0000000..14b6a7e --- /dev/null +++ b/bin/start_htwtxt.sh @@ -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 diff --git a/jessie_postinstall.sh b/jessie_postinstall.sh index 76a75f6..5305c14 100755 --- a/jessie_postinstall.sh +++ b/jessie_postinstall.sh @@ -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 index 0000000..8247df9 --- /dev/null +++ b/mails/htwtxt_restart @@ -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 index 0000000..e8e240d --- /dev/null +++ b/systemfiles/htwtxt_restart_reminder.service @@ -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