Skip to content

How can I send script output from cron? #719

Answered by cuu508
hugalafutro asked this question in Q&A
Discussion options

You must be logged in to vote

When it runs from cron,

  • do you see the "started" and "ok" events in the event log?
  • does it look like raspiBackup did in fact run? i.e., did it produce new backups and logfiles?

As an experiment, I just did the following on RPi 400 running Raspbian:

Created /home/user/experiment.sh and made it executable:

#!/bin/bash
curl -fsS --retry 3 https://hc-ping.com/my-uuid-here/start
m=$(/usr/games/cowsay hello)
curl -fsS --retry 3 -m10 --data-raw "$m" https://hc-ping.com/my-uuid-here/$?

Installed cowsay (sudo apt install cowsay) and created a cron entry for it:

* * * * * bash /home/user/experiment.sh 2>&1

I do see the success pings coming in every minute, and they do contain the request body w…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@hugalafutro
Comment options

Answer selected by hugalafutro
Comment options

You must be logged in to vote
2 replies
@cuu508
Comment options

@cuu508
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants