sysvinit-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sysvinit-devel] Sysvinit-devel Digest, Vol 55, Issue 1


From: Jesse Smith
Subject: Re: [sysvinit-devel] Sysvinit-devel Digest, Vol 55, Issue 1
Date: Sat, 8 Sep 2018 17:23:24 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

Hi Walter. Thanks for your patch to enable quiet mode in pidof. I have
tested the patch and committed to to our git repository. I've also
updated the man page for pidof to match.

Thanks for pointing out the -h flag was recognized but not used. I've
fixed that so pidof will display a short usage message with a list of
options.

The new -q flag will be featured in the upcoming 2.91 release, later
this year.

Jesse



> Hi List,
> i am a happy user of pidof and i am using it in scripts often
> to check for a programm running like.
>
> pidof programm >/dev/null || nohup programm &
>
> i am always missing the -q what is common to other programm to
> silence unwanted output. see below for a patch that add the -q
> option. btw: pidof supports also -h but has no check and no usage.
>
> hope that helps
> re,
>  wh
>
> --- killall5.c        2018-06-19 01:25:26.000000000 +0200
> +++ killall5.c.new    2018-08-27 15:43:56.000000000 +0200
> @@ -943,6 +943,7 @@
>  #define PIDOF_SINGLE 0x01
>  #define PIDOF_OMIT   0x02
>  #define PIDOF_NETFS  0x04
> +#define PIDOF_QUIET  0x08
>  
>  /*
>   *   Pidof functionality.
> @@ -966,7 +967,7 @@
>       if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
>               flags |= PIDOF_NETFS;
>  
> -     while ((opt = getopt(argc,argv,"hco:sxn")) != EOF) switch (opt) {
> +     while ((opt = getopt(argc,argv,"qhco:sxn")) != EOF) switch (opt) {
>               case '?':
>                       nsyslog(LOG_ERR,"invalid options on command line!\n");
>                       closelog();
> @@ -1008,6 +1009,9 @@
>               case 'n':
>                       flags |= PIDOF_NETFS;
>                       break;
> +             case 'q':
> +                     flags |= PIDOF_QUIET;
> +                     break;
>               default:
>                       /* Nothing */
>                       break;
> @@ -1065,15 +1069,17 @@
>                                               continue;
>                                       }
>                               }
> -                             if (!first)
> -                                     printf(" ");
> -                             printf("%d", p->pid);
> +                             if ( ~flags & PIDOF_QUIET) {
> +                                     if (!first)
> +                                             printf(" ");
> +                                     printf("%d", p->pid);
> +                             }
>                               first = 0;
>                       }
>               }
>       }
>       if (!first)
> -             printf("\n");
> +             if ( ~flags & PIDOF_QUIET) printf("\n");
>  
>       clear_mnt();
>  
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]