fixit7
25 September 2024 06:24
1
I can not get my crontab to run a script that uses notify-send.
The script runs o.k. from a terminal.
From crontab
50 06 * * * notify-send --expire-time=1000 "Water Dirt under satallite dish !!!"
It shows that it ran, but nothing showed on the screen.
024-09-25T01:27:01.879247-05:00 Scientist CRON[49040]: (andy) CMD (/usr/bin/notify-send --expire-time=5000 "Water Dirt under satallite dish.")
2024-09-25T01:27:01.884967-05:00 Scientist CRON[49034]: (CRON) info (No MTA installed, discarding output)
024-09-25T01:27:01.879247-05:00 Scientist CRON[49040]: (andy) CMD (/usr/bin/notify-send --expire-time=5000 "Water Dirt under satallite dish.")
2024-09-25T01:27:01.884967-05:00 Scientist CRON[49034]: (CRON) info (No MTA installed, discarding output)
It should have showed this
fixit7
25 September 2024 20:33
4
Thanks. I already found way that works.
#!/bin/bash
#----------------------------------------------------------------------------
# SatDiskMessage.sh
# Help from raj
#----------------------------------------------------------------------------
# echo $XDG_RUNTIME_DIR
# /run/user/1000
export XDG_RUNTIME_DIR=/run/user/1000
/usr/bin/notify-send --expire-time=5000 "Water Dirt under satellite dish !!!"
I put it in a cron job that ran every 5 minutes.
Those crontab generators at site are pretty good.
But none can come up with one that runs every 2 weeks.
2 Likes
I have used crontab before and didn't know you could use step values /
This may work, ChatGPT suggested it and reported this
0 0 */14 * *
This will run the script every 14 days starting from the beginning of the month. The interval between runs will always be 14 days, regardless of the day of the month.
Crontab.guru - The cron schedule expression generator *
4 Likes