From: Tristan Kohl via <help-guix@gnu.org>
To: help-guix@gnu.org
Subject: Re: How to configure smartd and send notifications?
Date: Tue, 21 May 2024 17:33:24 +0200 [thread overview]
Message-ID: <79C29ABD-8FFC-4930-A8E0-798ABF4EEB11@ymail.com> (raw)
In-Reply-To: <87jzjot5it.fsf@lease-up.com>
Hello Felix,
my last message was not to critizise your help but rather my frustration with my own limited progress. I really appreciate the help!
program-file at least results in a usable thing however since the script gets executed by smard I get the "command not found" in my logs. It seems like curl is not in PATH for smartd. Do I need to import something into the gexp?
Also those env variables are defined by smartd during runtime depending on which drive produced the error. Therefore I need shell expansion/env variables and have to use system (without *) imho.
This is the current state:
(define-smartd-send-ntfy
(program-file "send-ntfy"
#~(system
(string-append "curl " "-H \"Title: $SMARTD_SUBJECT\" " ...))))
Note: when using system* the error is:
In execvp of curl: No such file or directory
Thanks for bearing with me!
Tristan
On 21 May 2024 01:42:02 CEST, Felix Lechner <felix.lechner@lease-up.com> wrote:
>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
next prev parent reply other threads:[~2024-05-21 15:34 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
2024-05-21 15:33 ` Tristan Kohl via [this message]
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=79C29ABD-8FFC-4930-A8E0-798ABF4EEB11@ymail.com \
--to=help-guix@gnu.org \
--cc=blobbyjj@ymail.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).