/var/lib/pcp/testsuite/src/pmdashutdown.c is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /*
* Copyright (c) 1997-2002 Silicon Graphics, Inc. All Rights Reserved.
*/
#include <pcp/pmapi.h>
#include <pcp/pmda.h>
static void
usage(void)
{
fprintf(stderr, "Usage: %s [options]\n\n", pmGetProgname());
fputs("Options:\n"
" -D debugspec set PCP debugging options\n"
" -d domain use domain (numeric) for metrics domain of PMDA\n"
" -h helpfile get help text from helpfile rather then default path\n"
" -l logfile write log into logfile rather than using default log name\n"
"\nExactly one of the following options may appear:\n"
" -i port expect PMCD to connect on given inet port (number or name)\n"
" -p expect PMCD to supply stdin/stdout (pipe)\n"
" -u socket expect PMCD to connect on given unix domain socket\n"
" -6 port expect PMCD to connect on given ipv6 port (number or name)\n",
stderr);
exit(1);
}
int
main(int argc, char *argv[])
{
int err = 0;
pmdaInterface desc = { 0 };
pmSetProgname(argv[0]);
/*
* Honour the pmcd connection protocol ...
*/
pmdaDaemon(&desc, PMDA_INTERFACE_3, pmGetProgname(), desc.domain, "pmdashutdown.log", NULL);
if (desc.status != 0) {
fprintf(stderr, "pmdaDaemon() failed!\n");
exit(1);
}
if (pmdaGetOpt(argc, argv, "D:d:h:i:l:pu:6:", &desc, &err) != EOF)
err++;
if (err)
usage();
pmdaOpenLog(&desc);
pmdaConnect(&desc);
/*
* if we exit immediately the smarter pmcd agent initialization
* will notice, and report unexpected end-of-file ... so sleep
* for longer than pmcd is willing to wait, then exit
*/
sleep(10);
fprintf(stderr, "%s terminated\n", pmGetProgname());
exit(0);
}
|