Automated start of a x-server and own service - firefox

I'm currently developing on a automated info-system which is based on a self-written node-service which is also starting a firefox. This system should run in ubuntu without any controlling of anyone.
My current problems are lying in the autostart of the xServer and our own Service.
I created init.d-scripts which are working and linked in the rc-folders bei rc-update defaults etc.
(Xserver is started by startx in init.d)
The xServer is shutting down when reaching the login-screen of debian (without any gui) and the firefox in our service is reporting that it couldn't reach the display.
Sometines the xServer keeps running but there is no chance reaching it by programs with gui.
Is there a chance to run these setup?
Greetings and a happy new year,
Moritz

First you need to get rid of the X display manager being autostarted, that would be the xdm, gdm, kdm, leightdm, lxdm or something like that.
Then don't forget, that Linux manages its console as VTs (virtual terminals). You can tell the Xserver by the vt parameter on the command line, which VT to run on. Note, that the vt parameter doesn't has an option dash, e.g.
Xorg :100 vt14
starts the X server on VT 14. Now it can happen, that some other process switches the VT. So it might make sense to have some watchdog script, that switches back to the choosen VT if on the currently active VT nobody has been logged in (for maintenance for example). To switch a VT use the program chvt. And to make sure, that maintenance sessions are not forgotten open you can use some idle-detection program.

Related

Run a bootable USB of command prompt compatible with multiboot

I need to know if a program exists ( or if I can create) that runs that computer's command prompt from a USB, without having to log in. I guess I don't really care if it is that computers cmd, but I need all of the modern functions of today's cmd. I also need to make sure that it has full administrative privileges. I know that it is possible, because just about every Linux system uses a similar system when it initially boots up, even when just downloaded to USB.
I guess I really need something that I can use with multiboot (a pure ISO file, not something like Rufus, which requires you to format usb). I don't know, but I don't think an ms dos thingy would have all of today's commands in cmd.
Any help much appreciated. Piece.
Edit: I just need the equvolent of single user mode in a Mac. Administrative access to the terminal without login info.
You can boot windows to safe mode limited command prompt, or you can launch a cmd window via the startup group (but you can't get a full screen after XP and the window can be closed with the latter method).
That is the first issue for you to solve, and then you can consider booting from USB.

Run application after shutting down windows

Yesterday I ran a BIOS update on a Windows7 computer. The BIOS update tool performed a shutdown of Windows and without restarting the computer (so directly after Windows shutdown), a DOS-like tool started that updated the BIOS.
I searched the WWW but all I can find is how to execute applications at Windows shutdown (so before windows goes down) or at logoff (logoff scripts).
Does anyone have any clue on how to achieve this?
It is my guess that the machine had in fact performed a soft-reboot and was running BIOS code. That's the usual approach, and in some cases the soft-reboot may not be visible to the user, i.e., the BIOS self-update code may run before the POST.
However, it is (or at least used to be) possible to run Windows code post-shutdown, although obviously it is limited in what it can do. The key information can be found in the MSDN library entry on the Service Control Handler Function:
After this time expires, system shutdown proceeds regardless of whether service shutdown is complete. Note that if the system is left in the shutdown state (not restarted or powered down), the service continues to run.
So, at least in principle, all you need to do is to install a service that asks for shutdown notification but does not actually stop when shutdown occurs, and then instruct Windows to shut down without rebooting or powering off. I have actually seen this happen, but only on older versions of Windows (before automatically powering off at shutdown became the default!) so I can't guarantee that it still works, although it definitely did once.
It should, however, be noted that this will not necessarily give you the sort of environment you may be thinking of. For example, device drivers are not necessarily unloaded before shutdown; after all, what would be the point?
You can run Local Group policy - gpedit.msc (From run).
Under Computer Configuration choose Windows Settings
choose Scripts(Startup/Shutdown)
On Shutdown properties you can add script and also mention parameters if needed.
I also advised you to look at the following question - how to delay shutdown and run a process in window service

Preventing Windows 7 embedded standard shutdown

Other similar question mostly target Windows XP, where everything was easier. =)
I'd like my application to be able to postpone the windows shutdown transparently, without having windows show this screen:
Is there any option left to me after the Vista changes to the WM_QUERYENDSESSION handling?
The target here is Windows 7 standard embedded on an embedded device that runs only my application. Before shutting down the user needs to perform some manual steps that can not be postponed until the next start and must not be forgotten. I'd like to have the user confirm these steps before shutting down.
I've come to the conclusion, that there is no way to do this. =/
The workaround I've found is to allow shutdown only via the software at opportune moments. The start menu or task manager is not available to the user, and the hardware power button behavior can be configured to do nothing in the systems power options.

Help with remote debugging under linux

At present we are developing a graphic app on a linux box using opengl. We have had a bit of trouble getting a decent debugger working. At present we use GDB via a ssh connection, but that is a tad painful. Next we have tried running DDD on the target platform, but we run out of space on screen. Next we have tried running an xserver via cygwin on windows and doing an "export DISPLAY=RemoteHost:0.0" on the linux box. In this situation DDD will run on the windows box, but when we boot the app it also wants to pipe its output to the windows box.
What we really want to do is have DDD output on our windows box, and the output of the main app on the linux box.
I am not a x11 guru and I would love some help in this area.
Cheers
James
While logged in into the linux box:
DISPLAY=windows-box:0 ddd /path/to/app
DDD should now pop up on your windows box. If you run the app at that point, it will attempt to display on windows box as well, since the DISPLAY environment variable is inherited. You need to reset it:
(gdb) set env DISPLAY :0
(gdb) run
At that point, the app should display on the linux box, as desired.
Many applications accept -display command line argument. If yours does, an alternative is to do this:
(gdb) run -display :0
instead of resetting the DISPLAY environment variable.

Remotely run command in local X session?

I have an HTPC (with an HDTV as the monitor) running Ubuntu Karmic, and various other computers in the house. Sometimes I want to run X11 applications (usually, but not always, XBMC) on the HTPC displayed on the HDTV, but I don't want to have to physically go to the HTPC to do so; I want to do so from another computer in the house.
If I use ssh then, of course, the applications don't run because X isn't started on the connection. I don't want to use ssh -X or ssh -Y because I don't want to forward the display to my laptop: I want to do things in the X session already running on the HDTV. I don't want to use VNC or its ilk because sharing a 1080p display over an 802.11g network is nobody's idea of fun.
What I want is a command to run in a remote bash shell that executes in the local X session. Any ideas?
Try looking into the "xhost" command
Seems like I recall, 20 years ago, "xhost +" or something like that would cause your local X server to accept all incoming requests to create windows on the screen or grab input devices.
This is probably still reasonable to do only if you are behind a home firewall.
On the machine that actually runs the program whose display you wish to forward, you specify a -display option or DISPLAY env variable to forward the graphics window.
X security has changed in the past 20 years, I'm sure... so this may or may not work for you -- but I notice the xhost command is in my ubuntu 9.10

Resources