Question

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?

Was it helpful?

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.

OTHER TIPS

1) Its not always recommended to run things as root

2) You can also try ./firefox if you are in the current directory of firefox. In linux you need to pay attention to your path variable. Unless . (the current directory) is in your path you will have to type ./program if the program is in the same directory as you.

Also you need to pay attention to file permissions: In linux you have read-write-eXecute access.

ls -l will do a list of directories and show the file permissions:

drwxr-xr-x   10 user  staff     340 Oct  6  2012 GlassFish_Server/
drwx------@  15 jeffstein  staff     510 Oct  6 15:01 Google Drive/
drwxr-xr-x   20 jeffstein  staff     680 May 14  2013 Kindle/
drwx------+  67 jeffstein  staff    2278 Jan 26 14:22 Library/
drwx------+  19 jeffstein  staff     646 Oct 23 18:28 Movies/
drwx------+  15 jeffstein  staff     510 Jan  3 20:29 Music/
drwx------+  90 jeffstein  staff    3060 Mar  9 20:23 Pictures/
drwxr-xr-x+   6 jeffstein  staff     204 Nov  3 21:16 Public/
drwxr-xr-x   22 jeffstein  staff     748 Jan 14  2012 androidTools/
-rwxrwxrwx    1 jeffstein  staff    1419 Aug 28  2013 color.sh*

This is an example of ls -l here you can see color.sh has -rwxrwxrwx that means that anybody can read or write or run the file.

Without actually knowing where you installed firefox however I can't be of more help but these are some small pointers which might help.

try finding where firefox is actually installed using "whereis firefox" command. Then try using that path in at command.

In order to get directions on how to use a command type:

man at

this will display the "manual"

DESCRIPTION
     The at and batch utilities read commands from standard input or a speci-
     fied file.  The commands are executed at a later time, using sh(1).

     at      executes commands at a specified time;

     atq     lists the user's pending jobs, unless the user is the superuser;
             in that case, everybody's jobs are listed;

     atrm    deletes jobs;

     batch   executes commands when system load levels permit; in other words,
             when the load average drops below _LOADAVG_MX (1.5), or the value
             specified in the invocation of at run.

So obviously you need to schedule a job with at and you can see if it worked with atq

Read the manual and it should help - if i have more time I'll write you a quick example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top