script running with cron
-
Add full path to notify-send and chromium-browser binaries and test again. Also your PATH variable is missing / after =
-
@marcinozga said in script running with cron:
Add full path to notify-send and chromium-browser binaries and test again. Also your PATH variable is missing / after =
Sorry typo on the post my script does have it
-
@marcinozga said in script running with cron:
Add full path to notify-send and chromium-browser binaries
When I do a whereis notify-send I get:-
/usr/bin/notify-send
so just add that to the line?
/usr/bin/notify-send Testing
-
@hobbit666 yes.
-
Still no go.
It's Friday 16:50 and i'm off home in 10 minutes so a job for Monday -
Still having Cron job issues.
So ignore the script at the top. I've gone to basics:-
This is the script located here /home/display1/chrome.sh
(this has been created withnano chrome.sh
NOT sudo)#!/bin/bash sleep 5 pkill -o chromium sleep 10 chromium-browser https://www.bbc.co.uk & sleep 5 xdotool key F11
ran
chmod +x chrome.sh
to add executeif I
./chrome.sh
it runs and chrome opens. -
Now if I run
crontab -e
again no sudo (not sure if I should or not as the script will run with the user logged in15 15 * * * /home/display1/chrome.sh
when that time comes nothing happens.
-
@hobbit666 said in script running with cron:
Still having Cron job issues.
So ignore the script at the top. I've gone to basics:-
This is the script located here /home/display1/chrome.sh
(this has been created withnano chrome.sh
NOT sudo)#!/bin/bash sleep 5 pkill -o chromium sleep 10 chromium-browser https://www.bbc.co.uk & sleep 5 xdotool key F11
ran
chmod +x chrome.sh
to add executeif I
./chrome.sh
it runs and chrome opens.Add the full path for every command in the script. Use
which $command
to find any you don't know (I don't remember offhand where all these things live.) -
So I've added the following to the cron job
07 16 * * * /home/display1/chrome.sh > /home/display1/chrome.log 2>&1
Also changed the chrome.sh to just 3 lines
#!/bin/bash sleep 10 /usr/bin/chromium-browser sleep 5
So when it runs I look at the log file and see this:-
(Chromium-browser:3494): Gtk-WARNING **: 16:07:12.000: cannot open display:
-
@hobbit666 said in script running with cron:
So I've added the following to the cron job
07 16 * * * /home/display1/chrome.sh > /home/display1/chrome.log 2>&1
Also changed the chrome.sh to just 3 lines
#!/bin/bash sleep 10 /usr/bin/chromium-browser sleep 5
So when it runs I look at the log file and see this:-
(Chromium-browser:3494): Gtk-WARNING **: 16:07:12.000: cannot open display:
Ah, there we go. The shell it's running as doesn't have a graphical environment setup. I forget offhand how I got around this because I so rarely have to. The only recent cases I've used fed to feed images to a screen.
-
@travisdh1 Yeah think I may have found the solutions.
Will test and post back -
Looks like I needed to put
export DISPLAY=":0"
originally when I was trying it I didn't have the
"
Now to test the whole script