This is the mail archive of the cygwin@cygwin.com 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]

Re: cron on Win9x works


I see that cron was patch to touch SYSCRONTAB or create it if not there.
It's nice to see that one put to rest.

BB

"BB" <canofspam at att dot net> wrote in message
news:b7h7hu$kmk$1 at main dot gmane dot org dot  dot  dot 
>
> "Igor Pechtchanski" <pechtcha at cs dot nyu dot edu> wrote in message
> news:Pine dot GSO dot 4 dot 44 dot 0304111826300 dot 26381-100000 at slinky dot cs dot nyu dot edu dot  dot  dot 
> > On Fri, 11 Apr 2003, BB wrote:
> >
> > > "Igor Pechtchanski" <pechtcha at cs dot nyu dot edu> wrote in message
> news:Pine dot GSO dot 4 dot 44 dot 0304111656100 dot 26381-100000 at slinky dot cs dot nyu dot edu dot  dot  dot 
> > > > On Fri, 11 Apr 2003, BB wrote:
> > > >
> > > > > Igor,
> > > > > ----------------------
> > > > > cron/crontab on win9x:
> > > > >
> > > > > I don't think there is any way to change a directory's creation
time
> > > > > on Win9x, so cron cannot be signalled to read the new tabs.  The
> > > > > CreatFile flag FILE_FLAG_BACKUP_SEMANTICS is what does it on
> > > > > NT/2K/XP. According to the MSDN, the flag is not supported on
Win9x.
> > > >
> > > > According to MSDN, you cannot open a directory using CreateFile at
all
> on
> > > > Win9x.  You should use CreateDirectory.
> > >
> > > CreateDirectory creates a directory, it doesn't open it.  It doesn't
> > > return a handle to the directory.  Using CreateFile on WinNT/2K/XP,
the
> > > directory handle is then passed to SetFileTime.
> >
> > Umm, I don't know if CreateDirectoryEx will do the right thing here...
I
> > mean, first CreateDirectory("somedir"), then use "somedir" as a template
> > for the directory we're trying to touch...  I'll have to try it out on
my
> > Win98 machine...
>
>
> I don't think CreateDirectoryEx  will do the trick either.  I think that
in
> order to touch the directory timestamp without deleting it and recreating
> it,
> we need a handle to it. CreateFile is the only way I can find, but it
doesnt
> work on Win9x.  I think the solution would be for cron to detect a change
> using  either FindFirstChangeNotification or looping  through the files to
> get their timestamps.  I'll try FindFirstChangeNotification. Maybe we can
> get a patch for this done soon to put it to rest.
>
> >
> > > [snip]
> > > > > -------------------
> > > > > cygrunsrv on Win9x:
> > > > >
> > > > > When running cron as a 9x 'service', hiding the window is not the
> only
> > > > > problem.  Getting the app to terminate when the system shuts down
is
> the
> > > > > problem I've been dealing with.  By using an win gui app, I can
> monitor
> > > > > the messages to a hidden window to get the ENDSESSION message.
But,
> any
> > > > > code you have might help, especially if it eliminates the need to
> make
> > > > > it a GUI app with a hidden window.
> > > >
> > > > Umm, not really...  But it does eliminate the windows created when
the
> > > > service is run...
> > > >
> > > > > After a quick analysis, I think cygrunsrv could be modified.  If I
> > > > > modify cygrunsrv, I think I would need to change it to use
WinMain()
> > > > > so it's a GUI app.  On Win9x, it would create a window so it could
> > > > > get the ENDSESSION message at system shutdown.
> > > >
> > > > Hmm, I suggest another approach: write a rudimentary service manager
> for
> > > > Win9x.  This is not as bad as it sounds: you'll have only one
process
> that
> > > > will watch for the ENDSESSION message, and it'll have a similar
> interface
> > > > to the NT service manager, so cygrunsrv wouldn't need to be changed
> > > > (much).
> > >
> > > This sounds like more work than I have time for now.  I need a quick
> > > solution to get cron and init running as Win9x services with no window
> > > and a clean shutdown.
> > > Rebooting the machine is not a problem to get it going for my 'short
> > > term' need.
> >
> > Yes.  I was thinking long-term...  Even if we don't get to implement any
> > of this now, the discussion is going to stay in the archives, in case
> > someone wants to take a shot at it later.
> >
> > > I'll think about it over the weekend.  I would imagine on Win9x the
> > > cygwin service manager could be a GUI app that is started based on a
> > > RunServices entry.
> >
> > Right.  You'd only have to do that once, and then simply send it
requests.
> >
> > > What method of communication between cygrunsrv and the services
manager
> > > would you suggest for registering, unregistering, starting and
stopping
> > > services.
> >
> > I suppose the regular PostMessage should work.  If we want to do this
> > right, we'd have to implement part of the ServiceManager API (that
> > cygrunsrv uses).  If we succeed, cygrunsrv would be identical for both
> > Win9x and WinNT/2k/XP.  I'm guessing OpenSCManager will return a process
> > handle, OpenService would return some other handle (I'm not quite sure,
> > perhaps a pointer to a service data structure within the service
manager),
> > and then StartService, ControlService, CreateService, etc would send the
> > appropriate messages to the service manager.  Does this sound feasible?
> > It does look like quite a bit of work, though...
> > Igor
>
> We could implement the cygwin service manager as a dll. cygrunsrv would be
> modified to call it all the time regardless of win version.  The dll would
> map calls to either the actual WinNT service manager with almost no
overhead
> or it own version forWin9x. The service manager part of the dll could be
> started on Win9x by using RUNDLL32.EXE. All communication between cyrunsrv
> and the service manager would be handled within the DLLs code.
>
>
> > > > > Option -I would write an entry to the regitry key
> > > > >
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices
> > > > > such as init with the string value value
C:\cygwin\cygrunsrv.exe -S
> init
> > > > > It would need to store the parameters for init somewhere.  Maybe
> they
> > > > > could be stored in an init key under RunServices.
> > > >
> > > > Or we could create a completely new key... ;-)
> > > >
> > > > > The -S option on Win9x would only be modified to run the service
> rather
> > > > > than call the service manager to start it. This is how Win9x would
> call
> > > > > cygrunsrv at startup.  The options stored in the registry would be
> used
> > > > > to run the service.  cygrunsrv wouldnt return in this case until
the
> > > > > service exited.  register_9x_service(); would be called so the
> service
> > > > > would not be shut down when the user logs out.  On Win9x, a hidden
> > > > > window would be created so the app would be terminated at system
> > > > > shutdown. On termination, the term signal would be sent to the
> > > > > 'service'.  If you have a better way to hide the window, maybe
> WinMain
> > > > > would not be needed.
> > > >
> > > > The "service manager" could be a GUI app with a hidden window.
It'll
> only
> > > > need to respond to the messages from cygrunsrv and the ENDSESSION
> message.
> > > >
> > > > > By the way, is there and existing function that will convert the
> WinMain
> > > > > lpCmdLine or GetCommandLine() arguments to argc, argv format?
> > > >
> > > > Yes.  It's called WinMain in MSVCRT*.dll (or other C runtimes).
> > > >
> > > > > The -R option would simply remove the registry entries
> > > >
> > > > Makes sense.
> > > >
> > > > > The -E stop option would not be supported.
> > > >
> > > > Why not?  If we have our own "service manager", it could simply
issue
> a
> > > > signal to the service app, same way it happens on NT...
> > > >
> > > > > To actually run a service based on the RunServices registry entry,
> the
> > > > > system would need to be shut down and restarted.
> > > >
> > > > Ugh... Ugly.  I'd much rather the "service manager" always ran as
> service
> > > > (so restart is unavoidable if you want to start it), but later any
> > > > services you wish to run could be run through the already running
> service
> > > > (thus no restart required).
> > > > Igor
> > > >
> > > [snip]
> >
> > --
> > http://cs.nyu.edu/~pechtcha/
> >       |\      _,,,---,,_ pechtcha at cs dot nyu dot edu
> > ZZZzz /,`.-'`'    -.  ;-;;,_ igor at watson dot ibm dot com
> >      |,4-  ) )-,_. ,\ (  `'-' Igor Pechtchanski
> >     '---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
> >
> > Knowledge is an unending adventure at the edge of uncertainty.
> >   -- Leto II
> >
> >
>
>
>
>




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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]