[Top][All Lists]

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

Re: How to configure smartd and send notifications?

From: Tristan Kohl
Subject: Re: How to configure smartd and send notifications?
Date: Thu, 23 May 2024 21:25:08 +0200

Well look at me. So focused in my old ways on constructing a shell script that 
I did not even think about using Guile as the executable :D

Thank you Thomas an Felix for your pointers!

I read up about G-Expressions and got it almost working. But I must miss 
something because when executing the build result it makes the request 
successfully (checked return of http-get with pk and logs on the server) but 
still fails with this error:

                0 (primitive-load "/gnu/store/9gjnc0p...")

ERROR: In procedure primitive-load:
Wrong type to apply: #<unspecified>

(use-module (gnu) (guix modules))
(use-package-modules tls)

(define smartd-send-ntfy
  (program-file "smartd-send-ntfy"
    (with-extensions (list gnutls)
        (source-module-closure '((web client)))
        #~((use-modules (web client))
           (http-get "";))))))

On 21 May 2024 17:50:27 CEST, Tomas Volf <> wrote:
>On 2024-05-21 17:33:24 +0200, Tristan Kohl via wrote:
>> 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\" " ...))))
>Ignoring the obvious quoting issues here (what Felix does with `getenv' seems
>much safer, and should produce the same result?),
>> Note: when using system* the error is:
>> In execvp of curl: No such file or directory
>This should be solvable by using `file-append', so, basing on the system*
>variant, something like:
>    #~(system* #$(file-append curl "/bin/curl") <other-arguments-here>)
>Should invoke curl by absolute path.  (You need import (gnu packages curl) of
>Hope this helps,
>There are only two hard things in Computer Science:
>cache invalidation, naming things and off-by-one errors.

reply via email to

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