I would appreciate advice on why a script would run fine when the script is launched from a terminal command line, but some commands in the script seemingly do not run when the script is scheduled using the "at" command (and advice on how to get it to run correctly when scheduled). The script (named "open_browser.sh") is intended to open a browser at a scheduled time as follows:
#!bin/bash #script filename: "~/Desktop/open_browser.sh" #write to log file to verify script is running echo "Starting open_browser.sh" #set URL for browser STRING = "https://news.google.com/" #open browser - try with Firefox and Chromium #firefox $STRING chromium-browser $STRING #write to log file to verify script finishes echo "Ending open_browser.sh" #end of script
When I run the script from a terminal command line using "./~/Desktop/open_browser.sh > log_file", the script opens the selected browser in a visible (foreground) window and writes the echo statements to the log file. When I schedule the script with the "at" command, it opens the log file and writes all echo messages, but it does not open any visible browser window. I scheduled the script using "at" as follows:
$ at now + 1 min at> ./~/Desktop/open_browser.sh > log_file
I would be grateful for any insight as to why the script would open a browser when executed from the command line but seemingly not when scheduled using the "at" command.
For additional information, my installation has the default "at" deny file (
/etc/at.deny). I did not see any at.allow file.
Thanks in advance.