Search code examples
linuxterminalscheduled-tasksat-job

Automatically launching Firefox from terminal using at command


I am a beginner at linux and really enthusiastic to learn the OS. I am trying to launch Firefox(or any other software like Evince) from the command line as follows:

[root@localhost ~]# at 1637
[root@localhost ~]# at> firefox
[root@localhost ~]# at> ^d

The job gets scheduled without any error. But at the specified time it does not run. I also tried giving the following path:

[root@localhost ~]# at 1637
[root@localhost ~]# at> /usr/bin/firefox
[root@localhost ~]# at> ^d

Still no result. But When I try to use echo to display a text on the screen it appears at the specified time as desired. What might be the issue?


Solution

  • I think you have not set DISPLAY. at will run in separate shell where display is not set. try the following code.

    dinesh:~$ at 2120
    warning: commands will be executed using /bin/sh
    at>  export DISPLAY=:0
    at> /usr/bin/firefox > firefox.log 2>&1
    at> <EOT>
    job 7 at Tue Mar 11 21:20:00 2014
    

    If it is still failing check firefox.log for more information.