help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to configure smartd and send notifications?


From: Felix Lechner
Subject: Re: How to configure smartd and send notifications?
Date: Mon, 20 May 2024 16:42:02 -0700

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 via email to

[Prev in Thread] Current Thread [Next in Thread]