delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/08/03/14:55:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Originating-IP: [216.17.28.209]
X-Originating-Email: [niz87 AT hotmail DOT com]
X-Sender: niz87 AT hotmail DOT com
From: "D N" <niz87 AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: cygwin shell as a service
Date: Tue, 03 Aug 2004 18:55:26 +0000
Mime-Version: 1.0
Message-ID: <BAY9-F11bNSOgHNPI8K0001bc70@hotmail.com>
X-OriginalArrivalTime: 03 Aug 2004 18:55:26.0975 (UTC) FILETIME=[7099A8F0:01C4798B]
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019