unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Felix Lechner via <help-guix@gnu.org>
To: Tristan Kohl <blobbyjj@ymail.com>, help-guix@gnu.org
Subject: Re: How to configure smartd and send notifications?
Date: Mon, 20 May 2024 16:42:02 -0700	[thread overview]
Message-ID: <87jzjot5it.fsf@lease-up.com> (raw)
In-Reply-To: <0525BF4D-96C2-4F58-BB27-19A88DD8403E@ymail.com>

Hi Tristan,

On Mon, May 20 2024, Tristan Kohl via wrote:

> smartd then complains that the file is not executable...

Sorry, it was a Monday morning for me.

If you are comfortable using Guile---which I'm sure you almost are by
now--You can use 'program-file':

Please have a look at any of these hooks on one of my systems. [1]

An untested version of your script might look something like this,
although I probably got some of the quoting wrong---either in Scheme or
in your command.

(define smartd-send-ntfy
  (program-file "send-ntfy"
  #~((let* ((subject (getenv "SMARTD_SUBJECT))
            (device (getenv "SMARTD_DEVICE))
            (failure-type (getenv "SMARTD_FAILTYPE))
            (timestamp (getenv "SMARTD_TFIRST"))
            (message (getenv "SMARTD_MESSAGE")))
       (system* "curl"
                "ntfy.sh/<my-topic>"
                "-d" (string-join
                      `("curl"
                        "-Ls"
                        "-H" ,(string-append "Title: " subject)
                        "-d" ,subject
                        "-d" ,(string-append
                                "'"
                                (string-join (list "Device:" device
                                                   "Time:" timestamp
                                                   "Message:" message))
                                "'"))))))))

Kind regards
Felix

[1] https://codeberg.org/lechner/system-config/src/commit/215fc20a29e553fd8108ba737d557ecb98279540/host/wallace-server/operating-system.scm#L1134-L1168


  reply	other threads:[~2024-05-20 23:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4D873504-6540-477A-A2DB-DE293395CAFC.ref@ymail.com>
2024-05-19 22:48 ` How to configure smartd and send notifications? Tristan Kohl via
2024-05-20 11:30   ` Felix Lechner via
2024-05-20 13:56     ` Tristan Kohl via
2024-05-20 15:04       ` Felix Lechner via
2024-05-20 19:15         ` Tristan Kohl via
2024-05-20 23:42           ` Felix Lechner via [this message]
2024-05-21 15:33             ` Tristan Kohl via
2024-05-21 15:50               ` Tomas Volf
2024-05-23 19:25                 ` Tristan Kohl via
2024-05-24  4:10                   ` Felix Lechner via
2024-05-24 10:19                   ` Tomas Volf
2024-05-31 13:42                     ` Tristan Kohl via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzjot5it.fsf@lease-up.com \
    --to=help-guix@gnu.org \
    --cc=blobbyjj@ymail.com \
    --cc=felix.lechner@lease-up.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).