I want to make some notification to user every day at the same time:
any_hour:50
And I wrote to crontab -e
:
50 * * * * DISPLAY=:0 /usr/bin/notify-send -i /home/nazar/Pictures/icons/download_manager.png "Break" "Make a break for 10 min"
When I run it from console:
notify-send -i /home/nazar/Pictures/icons/download_manager.png "Break" "Make a break for 10 min"
I have desired result:
But when I working at PC I don't have this output at desired time.
Any suggestion?
UPDATE:
I updated cron job to:
50 * * * * DISPLAY=:0 /usr/bin/notify-send -i /home/nazar/Pictures/icons/download_manager.png "Work Break" "Make a break for 10 min, please!" 2>&1 | tee -a cron.out
After executing it file was created but it is empty.
I tried to update my cron job as follows:
00 13 * * * /home/nazar/Documents/scripts/lunch_break_job.sh
50 * * * * /home/nazar/Documents/scripts/pc_break.sh
# just cron test
*/1 * * * * /home/nazar/Documents/scripts/cron_job_test.sh
and cron_job_test.sh
looks:
#!/bin/bash
export DISPLAY=0.0
export XAUTHORITY=/home/matrix/.Xauthority
if [ -r "$HOME/.dbus/Xdbus" ]; then
. "$HOME/.dbus/Xdbus"
fi
/usr/bin/notify-send "hello"
when I run this script from terminal:
./cron_job_test.sh
I get notification correctly.
But crontab doesn't run this script every minute.
Why does this happen?
And how to resolve execution of this cron job?
2>&1 | tee -a cron.out
to your job to create a log file. – dhag Dec 04 '15 at 16:532>&1 | tee -a cron.out
to the end of your cron job, and, after it runs, look in filecron.out
. – dhag Dec 04 '15 at 18:02cron_job_test.sh
you pasted is missing the closing"
(last line). Is this just a copy & paste error? (Please [edit] your question and fix it if so.) – derobert Dec 04 '15 at 21:14