Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com Message-ID: <3B0A99E7.2E76F222@ontosys.com> Date: Tue, 22 May 2001 11:55:03 -0500 From: Fred Yankowski X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: Corinna Vinschen Subject: cygrunsrv logging OK; patch to --args handling References: <3B09511A DOT 61C383B AT ontosys DOT com> <20010521213404 DOT Q8783 AT cygbert DOT vinschen DOT de> Content-Type: multipart/mixed; boundary="------------8E097E653A8338544969D4F7" This is a multi-part message in MIME format. --------------8E097E653A8338544969D4F7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Corinna Vinschen wrote: > I have added the stdio redirection facility now. It's in CVS. > Is anybody interested to test it before releasing it? The --stdin and --stderr options seem to work well for me, and the default of logging to /var/log/.log also works well. OT: The code to handle quotes in the --args value didn't work for me until I applied the attached small patch. I've tested it in a few cases, but it deserves a careful inspection. With this change, cygrunsrv does a good job of wrapping a PostgreSQL service, except for the NT-shutdown case (which I haven't tested yet). Here is how I'm setting up that service: /usr/local/src/cygrunsrv-cvs/cygrunsrv.exe --install postmaster2 \ --path /usr/local/pgsql/bin/postmaster \ --args "-D /usr/local/pgsql/data -i -d 2 -o '-o /var/log/postgres.log'" \ --dep ipc-daemon --termsig INT --user postgresql I was using --stderr too, but the default works just as well. -- Fred Yankowski fred AT OntoSys DOT com tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA --------------8E097E653A8338544969D4F7 Content-Type: text/plain; charset=us-ascii; name="stopchar.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="stopchar.patch" Index: cygrunsrv.cc =================================================================== RCS file: /home/cvs/cvsroot/src/cygrunsrv/cygrunsrv.cc,v retrieving revision 1.5 diff -u -p -r1.5 cygrunsrv.cc --- cygrunsrv.cc 2001/05/21 19:26:30 1.5 +++ cygrunsrv.cc 2001/05/22 16:51:41 @@ -424,9 +424,9 @@ eval_arglist (const char *path, char *ar arglist = tmp; arglist[count - 2] = c; arglist[count - 1] = NULL; - while (*c && *c != ' ') + while (*c && *c != stopchar) ++c; - if (*c == ' ') + if (*c) *c = '\0'; else --c; --------------8E097E653A8338544969D4F7 Content-Type: text/plain; charset=us-ascii; name="ChangeLog" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ChangeLog" 2001-05-22 Fred Yankowski * cygrunsrv.cc (eval_arglist): Fix handling of quoted options. 2001-05-21 Corinna Vinschen * Bump version to 0.93. 2001-05-21 Corinna Vinschen * cygrunsrv.cc (longopts): Add `--stdin', `--stdout' and `--stderr' options. (opts): Add `-0', `-1' and `-2' options. (install_registry_keys): Add handling for stdio redirection file names. (get_reg_entries): Ditto. (service_main): Ditto. (get_opt_string_entry): New function. (reeval_io_path): Ditto. (main): Add handling for stdio redirection options. * cygrunsrv.h (PARAM_STDIN): New registry name for stdin redirection file name. (PARAM_STDOUT): Ditto for stdout. (PARAM_STDERR): Ditto for stderr. (DEF_STDIN_PATH): New define, default path for stdin redirection. (DEF_LOG_PATH): New define, default directory where log files are written. * utils.cc (reason_list): Add error strings for --std{in,out,err} errors. (usage): Add help text for --std{in,out,err}. (redirect_fd): New function. (redirect_io): Ditto. (create_parent_directory): Ditto. * utils.h (reason_t): Add codes for --std{in,out,err} errors. Add declaration for new functions. 2001-05-21 Corinna Vinschen * utils.cc (usage): Change --dep text slightly. 2001-05-21 Fred Yankowski * utils.cc (reason_list): Add error strings for --dep errors. (usage): Add help text for --dep. * utils.h (reason_t): Add codes for --dep errors. * cygrunsrv.h (MAX_DEPS): Number of --dep values allowed. (MAX_DEPS_STR): String value of MAX_DEPS. * cygrunsrv.cc (install_service): Create service with optional dependencies. (add_dep): New function to save --dep command-line value. (main): Handle --dep option. (longopts): Add '--dep' option. (opts): Add 'y' option. 2001-05-21 Corinna Vinschen * cygrunsrv.cc (install_registry_keys): Create environment strings in subkey "Environment" now. (get_reg_entries): Read environment strings from subkey "Environment" now. (add_env_var): Drop test for illegal environment string names "AppPath" and "AppArgs". * cygrunsrv.h (PARAM_ENVIRON): New registry name for environment string subkey. 2001-05-18 Fred Yankowski * utils.cc (usage): Add help for --termsig option. (reason_list): Add error strings for wrong --termsig usage. * cygrunsrv.cc (get_reg_entries): Get --termsig value from registry. (service_main): Set up global termsig value. (terminate_child): Send termsig signal to server process. (termsig): Create new global variable to hold --termsig value. (install_registry_keys): Save --termsig value. (longopts): Add '--termsig' option. (opts): Add 's' option. (main): Handle '--termsig' option. * cygrunsrv.h (PARAM_TERMSIG): New registry name for --termsig value. * utils.h (reason_t): Add codes for '--termsig' errors. 2001-05-11 Corinna Vinschen * utils.cc: New file. Move several functions from cygrunsrv.cc to here. * utils.h: Ditto. (reason_t): Add error codes for wrong --type usage. * utils.cc (winerror): New function providing strerror functionality for Win32 errors. (reason_list): Add error strings for wrong --type usage. (error): Add windows error message text to error output. (syslog_starterr): New function. * cygrunsrv.cc (longopts): Add `--type' option. (opts): Add `t' option. (type_t): New type. (usage): Add help for `--type' option. (install_service): Add parameter for service start type. (service_main): Use syslog_starterr function. (main): Add handling for `--type' option. * Bump version to 0.92. 2001-05-10 Corinna Vinschen * (get_reg_entries): Fix memory usage. * (install_service): Add interactive password request if password is omitted. * Control access to SERVICE_STATUS by using a critical section. Move access functions to new file crit.cc. Declare access functions in crit.h. * Bump version to 0.91. 2001-05-09 Corinna Vinschen * Initial version 0.9. --------------8E097E653A8338544969D4F7--