Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Launching firefox browser just after dhcp request on Linux

Posted on 2008-06-25
14
Medium Priority
?
302 Views
Last Modified: 2013-12-16
Hello,
I'm developing linux based application. After entering into init 5 level, system make dhcp request to assign ip address to ethernet card. Just after that I need to launch firefox browser before any other service comes up. After Im done(after closing the browser), then I would like network service initailization continued.
I don't know what extact command or sequence of commands I need to execute to launch the browser.
and where extactly (file and place)I need to call these commands.

Please advise.
0
Comment
Question by:pkgoyal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
14 Comments
 
LVL 14

Expert Comment

by:arrkerr1024
ID: 21867123
What distribution are you using?  You'd have to launch a window manager before you can launch firefox...
0
 

Author Comment

by:pkgoyal
ID: 21867970
I'm using fedora core 6. Yeah I know that I need to launch window manager.. but how should I do that...
what command should I issue to launch both window manager as well browser...
0
 
LVL 14

Accepted Solution

by:
agriesser earned 1000 total points
ID: 21872709
Use `startx`. It starts the X server plus the first X client mentioned in a file called xinitrc. xinitrc usually resides in $HOME of the user starting `startx`, so if you're going to run `startx` as root, make sure you have a file /.xinitrc that contains the following lines:

The only problem with this approach is that the X server stops after the last X client has finished.
The invocation of firefox drops you immediately back to the command line which would cause the X server to shutdown right after it started firefox.

You need to add a program in the last line of xinitrc that either never quits or stays active as long as the user doesn't quit this application.

Depending on your needs you could even start a tiny window manager first (e.g. icewm) and start firefox right after icewm has started.

What's appropriate for your environment? What do you want to achieve?
#!/bin/sh
 
firefox

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:eager
ID: 21876947
What are you trying to do?  

You really should not be using a browser (or any other user-mode UI program)  in the middle of system initialization.  It has far too many dependencies on other services which may not yet be started.  

The init scripts which are part of system startup are run as root.  You really don't want to run user applications, such as firefox, as root.  There are just too many security holes.

If there is specific information which you need from a web server, look at using wget and other command line tools to obtain that info. This can be used to create a script which can be added to /etc/init.d.
0
 

Author Comment

by:pkgoyal
ID: 21881151
This is a kind of thin client... it will have very limited resouces and authentication will be done by server.
User bowser will be launched as root just after client gets ip via dhcp. and user is supposed to enter user name and password and after this only I need to start rest of required services.
So kindly tell me where (source code or script,) where  ip assignmnet via dhcp takes place so that just after that I can write code to launch the browser.
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21881325
That depends on the linux distribution you're using. Usually, there are init scripts in /etc/init.d, one of them might be called "networking" or "network" or something like this.
After this script has completed, you should got an IP address and can start the browser/X Server then.
0
 
LVL 8

Assisted Solution

by:eager
eager earned 1000 total points
ID: 21881585
Why start a browser to get username and password?  What did you expect your browser to do if you enter the right or wrong username/password?   When (or if)  the user closes the browser, your system will continue to initialize.  

As I said, running a browser as root is an invitation for security troubles.  The browser is controlled by the user, not by the system.

It's easy to write a small bash script which can prompt for username/password and use any of several different ways to validate this with the server.  SOAP is one way.  

The sequence of startup operations is controlled by /etc/rc?.d, where ? is the init mode.  Normal graphical startup is mode 5.  In each directory there are links to scripts in /etc/init.d which start with an S if the script is to be run when entering the mode, and K if it is to be run when exiting the mode.  Entries are run in ascending order.  
0
 

Author Comment

by:pkgoyal
ID: 21881747
I just tried startx /usr/bin/firefox (as suggested by agriesser )after booting my system in init level 3 after login into the system as root.
It started the window manager and launched the browser as well. But when I closed the brwoser window I did not get  the same command prompt(why ?) from where I invoked the command rather I got blank screen and I had to restart my machine.
0
 

Author Comment

by:pkgoyal
ID: 21881754
For eager question: to start brwoser is requirement from my customer. I've to do that....
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21881812
Are you booting in framebuffer mode? That usually happens when the console framebuffer is enabled and the Xorg driver has troubles to get the framebuffer mode back up after the X Server has quit.

@eager: As far as I understand, it's a thinclient, so no data on it, no security stuff.
Besides that, when the browser has been quit at the end of the initialization process, there's still the console login which needs to be passed to get access to this system.

I could even think of a script that shuts down the thinclient when the browser has quit.
0
 

Author Comment

by:pkgoyal
ID: 21913710
Are you booting in framebuffer mode?
What is framebuffer mode.
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21918259
The framebuffer mode on the console allows for having fancy graphics while booting (e.g. your distribution's logo, a progress bar, etc.) and gets you highter resolutions (you're not limited to the 80x25 lines in plain text mode).

To see if you're booting in framebuffer mode, issue the command `cat /proc/cmdline` and check for the existance of a "vga=" parameter. If it's set to something else than "normal", you're booting in framebuffer mode.

To make your system boot in console mode, edit your bootloaders configuration file (/boot/grub/menu.lst usually) and replace the "vga=something" with "vga=normal" or simply remove the "vga=..." option at all.
0
 
LVL 14

Expert Comment

by:agriesser
ID: 21988565
Any updates on this one?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question