This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygwin shell as a service


Hi,

I am trying to solve a problem that is a bit "out of the box":

For my cygwin implementation, I need to do this:
-Start the cygwin shell (bash) as a windows service, hidden (no console). Reason being, I
cannot have someone closing the console, which would then kill all processes launched FROM
that window. Having it run as a service would ensure it starts on boot rather than upon my
admin user logging in via remote desktop.


-Start various daemons from within the cygwin shell, rather than as windows services:
sshd/proftpd/cron/(and init???)


-Start various programs from within the cygwin shell, some with console/GUI windows that
need desktop interaction.


I have noticed a few things with this.

First, the sshd/proftpd/cron processes fork children when someone connects or when cron jobs
are carried out, but the children do not die upon disconnect/completion. I have a feeling
that I am not passing the correct arguments to those, and they are not being run as daemons
but rather as processes.


Second, do I need to run the cygwin shell service as LocalSystem, or as as my admin user?
Reason being, some of the processes I would like to launch from within the cygwin
environment have console/GUI windows that I need to interact with on the desktop of my admin
user.


The reason for this whole mess is to provide a linux-like environment for my windows game
servers. I noticed that if I run sshd the usual way, as a windows service with cygrunsrv,
that the GUI windows of the applications are not "drawn" anywhere if they are launched from
ssh. They are "drawn" on the desktop if I launch them from the cygwin console though. I
briefly investigated SFU (services for unix), and I found this blurb about "window stations"
on that site: http://www.interopsystems.com/tools/FAQ.htm#8


I assume this non-drawing issue is the same issue present with SFU (and therefore a
microsoft problem rather than a cygwin/SFU problem).


This is remedied if I run the sshd directly from the cygwin shell rather than as a separate
service (/usr/sbin/sshd.exe), although it forks many copies of itself that do not die. I
think I can solve that as I mentioned above by ensuring it is run as a daemon rather than
just a process.


Thus, by possibly making the entire cygwin system load up as a service, hidden, I figure I
can eliminate the possibility of someone closing the cygwin shell window and killing all
subsequent processes. Does that sound rational / possible?


The only detail left is HOW to actually do that. Here is a short summary of what I had in
mind:
1. Windows boots up
2. Cygwin (bash) shell service started
3. Cygwin shell launches other daemons via sysVinit (sshd, proftpd, etc)
4. Cygwin shell launches my GUI programs via rc.local or equivalent


Can someone help me carry this out? Thanks!

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]