Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to startx on a webserver running init 3

Status
Not open for further replies.

unomateo

IS-IT--Management
May 9, 2006
38
0
0
US
I need to start the x server system on a remote webserver. the server is running fedora 5. the server boots to runlevel 3. I have tried to change to runlevel 5, then startx...but run into many errors during x startup.

I'm trying to use scrot to take a screenshot on the server, but I need x server started.

how do I startx?
 
If you change the runlevel, you should reboot to have it take effect.

startx is often dependent upon 'gpm' and 'xfs' daemons/services running first. If those are running then you should be able to get 'startx' to go... however, I'm not sure if startx is effective when you launch it via a remote ssh shell session. you might need to run it with 'nohup startx &'

good luck.

D.E.R. Management - IT Project Management Consulting
 
thedaver said:
If you change the runlevel, you should reboot to have it take effect.

That shouldn't be the case unless your startup scripts have been seriously messed up. Simply switching to the correct runlevel should have exactly the same result.

unomateo, what exactly are the errors when you try and startx? Ignore all the warning and info messages. I presume you are working from the console on the system (i.e. standing in front of it rather than connected remotely)?

Annihilannic.
 
Anni,
We'll yes, I wasn't paying strictest attention because I wanted to answer in the context of rebooting a remote server since runlevel was the concern... So yes you're right, the OP needs to switch to runlevel 5 AND reboot, OR do nothing about runlevel 3 AND re-/start xfs, gpm, and startx

D.E.R. Management - IT Project Management Consulting
 
a little more about what I'm attempting to do.

I'm trying to make a website thumbnailer, so when someone adds a link, I take a screenshot and thumbnail, similar to snap.com or alexa.


so, I installed scrot on the server, but need to have X server running. Since it is a webserver only it is in runlevel 3. I changed the runlevel to 5. I did not have to reboot. Startx caused all kinds of errors, and would never start. I think it is already running...

so then I try to run scrot, I get this error:
giblib error: Can't open X display. It *is* running, yeah?

I find out that the DISPLAY needs to be set...
so I run "export DISPLAY=:5" to add to environment

I run scrot again. it works, it takes a screenshot of an ugly screen...no window decoration at all, just light green with an xterm window... cool, it somewhat works

Now I try to start a window application to see if I can take a screenshot... I try xeyes. So I run "xeyes &" then scrot again

scrot just hangs and does not take a screenshot anymore.

I have found that the .Xauthority file has a lot to do with it. even after I kill xeyes, I cannot take a screenshot. I have to delete the .Xauthority file and then copy the root .Xauthority file to home directory to take screenshots again.

So, I think when I run xeyes, or any other app like xterm it takes control of the .Xauthority file and then scrot cannot get permission to take a screenshot

Any suggestions?


 
First, you need to run Xserver on the machine that you are using not the server.

Remember Xserver is running on the machine that handles your display, not the machine that the program is running at. :)

Then you need to setup xtunnling when you do ssh, try: "ssh -X hostname".

Now install scrot on your machine (not the server).

Now you ryn "xeyes" on the server and take a screenshot with scrot from another terminal window on you machine (not the server).
 
Gunnard,

I think I need to explain a little more.

I have a webserver that hosts my website. On my website I want to enter a url and get the screenshot of that url webpage.

To get the screenshot I am going to run scrot with shell_exec php function. First i need to open firefox on the webserver and then take the screenshot.

But really, I don't understand why any application on the webserver is causing these problems. Even if I don't have a display on the server, I should still be able to open xterm, and then close it down, but it is just not working.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top