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/<svc_name>.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           [EMAIL PROTECTED]      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA
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;
2001-05-22  Fred Yankowski  <[EMAIL PROTECTED]>

        * cygrunsrv.cc (eval_arglist): Fix handling of quoted options.

2001-05-21  Corinna Vinschen <[EMAIL PROTECTED]>

        * Bump version to 0.93.

2001-05-21  Corinna Vinschen <[EMAIL PROTECTED]>

        * 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 <[EMAIL PROTECTED]>

        * utils.cc (usage): Change --dep text slightly.

2001-05-21  Fred Yankowski  <[EMAIL PROTECTED]>

        * 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 <[EMAIL PROTECTED]>

        * 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  <[EMAIL PROTECTED]>

        * 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 <[EMAIL PROTECTED]>

        * 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 <[EMAIL PROTECTED]>

        * (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 <[EMAIL PROTECTED]>

        * Initial version 0.9.

Reply via email to