gotify / cli

A command line interface for pushing messages to gotify/server.
MIT License
444 stars 58 forks source link

issue with cron #73

Closed AnthillSudoku closed 2 months ago

AnthillSudoku commented 2 months ago

Hi, I am trying to use a working gotify-cli in cron (debian bookworm). As a test:

  1. crontab -e
  2. add at the end

    /2 * gotify push "message"

  3. sudo systemctl restart cron

actual behaviour

the job is run, but no message is pushed

additional notes

no issue if the command is replaced with curl, as stated in the readme:

curl "https://push.example.de/message?token=<apptoken>" -F "title=my title" -F "message=my message"

Thanks

eternal-flame-AD commented 2 months ago

Have to confirmed that the gotify executable actually is invoked? I don't use cron anymore but I remember they do not consider user shell PATHs so you may need to use the absolute path unless you put gotify in /usr/local/bin or something

eternal-flame-AD commented 2 months ago

Cron is a straight exec() environment so any user shell profiles won't be in effect, you can spawn a shell manually to get around this

AnthillSudoku commented 2 months ago

Have to confirmed that the gotify executable actually is invoked? I don't use cron anymore but I remember they do not consider user shell PATHs so you may need to use the absolute path unless you put gotify in /usr/local/bin or something

gotify is already in /usr/local/bin/, but I have to use /usr/local/bin/gotify to make it works