Solved

Launching firefox browser just after dhcp request on Linux

Posted on 2008-06-25
14
279 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 250 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 250 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

736 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