Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  23] [ 0]  / answers: 1 / hits: 41530  / 2 Years ago, wed, january 5, 2022, 9:06:00

I made a script that should notify me when there's a new chapter of manga that I'm reading.
I used the command notify-send to do this.
The program works when I am trying to run it in terminal.
The notification is showing.
However, when I placed this in my crontab, the notification doesn't show.
I'm pretty sure that the program is running since I made it to create a file for me.
The file was created, but the notification didn't show.



Here's my script



#!/bin/bash   
#One Piece Manga reminder
#I created a file named .newop that contains the latest chapter.
let new=$(cat ~/.newop)
wget --read-timeout=30 -t20 -O .opreminder.txt http://www.mangareader.net/103/one-piece.html

if (( $(cat .opreminder.txt | grep "One Piece $new" | wc -l) >=1 ))
then
(( new+=1 ))
echo $new
echo $new > ~/.newop
notify-send "A new chapter of One Piece was released."
else
notify-send "No new chapter for One Piece."
notify-send "The latest chapter is still $new."
fi
exit


And here's what I wrote in my crontab



0,15,30,45 12-23 * * 3   /home/jchester/bin/opreminder.sh

More From » cron

 Answers
5

Commands need to reference their location. So notify-send needs to be /usr/bin/notify-send



All commands need to have their full path.



Use the whereis notify-send command to see where your commands "live"


[#31100] Wednesday, January 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nerta

Total Points: 414
Total Questions: 103
Total Answers: 97

Location: England
Member since Wed, Apr 19, 2023
1 Year ago
;