piktc commands
Here are some example piktc preprocessor commands. Note the piktc command summary below.
Syntax check all configuration files for all perf machines except those running Linux:
# piktc -cv +H perf -H linux checking paris3... checking paris4... ...By means of (re)enablement, register a different timing for the EMERGENCY alert on the db machines:
# piktc -ev +A EMERGENCY +H db processing athens2... enabling alert(s)... EMERGENCY enabled processing athens4... enabling alert(s)... EMERGENCY enabledInstall a modified Critical alert on all perf and mus machines except the mus machine, kiev0, which is down for system maintenance; disable command exec'ing for testing purposes:
# piktc -iv -D doexec +A Critical +H perf mus -H kiev0 processing kiev... installing file(s)... Critical.alt installed processing paris... installing file(s)... Critical.alt installed ...Install all PIKT web pages, updating all dynamic #include files before doing so:
# piktc -iIv +D pikt +F =piktdocs +H piktweb processing ottawa... installing file(s)... systems.cfg.html installed defines.cfg.html installed macros.cfg.html installed ...Diff the PIKT index.html web page:
# piktc -fv +D pikt +F index.html +H piktweb
processing ottawa...
fetching file(s)...
index.html fetched
diffing file(s)...
diff -r /pikt/lib/configs/staging/var/www/html/pikt/index.html
/pikt/lib/configs/diffing/var/www/html/pikt/index.html
231c231
< <font size="1" color="#000099">Page last updated 2004-09-10.</font>
---
> <font size="1" color="#000099">Page last updated 2004-09-09.</font>
Install a revised inetd.conf, with backup, on the moscow system:
# piktc -ivb +F inetd.conf +H moscow processing moscow... installing file(s)... inetd.conf installedRestore the earlier inetd.conf from backup:
# piktc -Bv +F inetd.conf +H moscow processing moscow... restoring file(s)... inetd.conf restoredRestart inetd on Linux systems, and do it quickly (no wait) and silently:
# piktc -X +C "=prgdir/SigHupInetd.pkt" +H linux -H downReport the status of all alerts, except the Notice and Info alerts, on all Linux machines:
# piktc -sv -A Notice Info +H linux processing seville... showing alert stata... Debug active Warning active Critical active Urgent active EMERGENCY activeInstall new SysDevs, SysDirs, and SysFiles object lists on murmansk:
# piktc -iv +O SysDevs SysDirs SysFiles +H murmansk processing murmansk... installing file(s)... SysFiles.obj installed SysDirs.obj installed SysDevs.obj installedDelete the apls.pl program on brussels:
# piktc -tv +P apls.pl +H brussels processing brussels... deleting file(s)... apls.pl deletedList all object files on cologne:
# piktc -lv +O all +H cologne processing cologne... listing file(s)... PiktFiles.obj found SysDirs.obj found DiskCaps.obj not found ...Kill the piktd daemon on the machine rome:
# piktc -kv +H rome processing rome... killing alert daemon... alert daemon killedRestart the piktd daemon on rome and on the non-perf, non-linux mailservers:
# piktc -rv +H mailserver rome -H perf linux processing antwerp... (re)starting alert daemon... alert daemon (re)started processing rome... (re)starting alert daemon... alert daemon (re)started ...Delete all traces of the Test alert on moscow:
# piktc -tv +A Test +H moscow processing moscow... disabling alert(s)... Test disabled deleting file(s)... Test.alt deleted deleting file(s)... Test.hst deleted deleting file(s)... Test.log deletedInstall all files, enable all alerts, and restart piktd, on all systems:
# piktc -ierv ALL ...Do as above, except on Linux systems, and turn on debug mode:
# piktc -ierv +D debug ALL -H linux ...Check to see if we have left any /etc/nologin files on the perf systems:
# piktc -xv +C "=ls /etc/nologin" +H perf processing paris... executing command(s)... /etc/nologin: No such file or directory "/bin/ls /etc/nologin" executed processing paris7... executing command(s)... /etc/nologin "/bin/ls /etc/nologin" executed ...Restart the syslog daemon on calgary:
# piktc -xv +C "=syslog_restart" +H calgary processing calgary... executing command(s)... Shutting down syslog services..done Starting syslog services..done "=syslog_restart" executedMD5 checksum all alert files on moscow:
# piktc -m5v +A all +H moscow processing moscow... checksumming file(s)... Warning.alt checksummed Critical.alt checksummed Urgent.alt checksummed EMERGENCY.alt checksummed ...Generate a list of all perf systems:
# piktc -L +H perf paris paris7 paris8 ...See also the PIKT Tutorial and various other Samples pages for additional example piktc commands.
For your reference, here are all of the current piktc options:
# piktc -h
Usage: piktc <-bBcCdefGhiIkKlLm#Mp#QrRstTUvVwWxXzZ>
[+|-D <define(s)>]
[+|-E <envar(s)>]
[+C <command(s)>]
[+M <macro(s)>]
[+|-A|S[f] all|<alert(s)/script(s)>]
[+|-P[f] all|<program(s)>]
[+|-F[f] all|<file(s)>]
[+|-O[f] all|<object(s)>]
+|-H all|<host(s)>
[ALL]
-b backup alert/script/program/file/object
file(s)
-B restore alert/script/
program/file/object
file(s) from backup
-c syntax check all config files
-C syntax doublecheck all config files
-d disable alert(s)
-e enable alert(s)
-f diff alert/script/program/file/object
file(s)
-G run in debug mode
-h show program help
-i install alert/script/
program/file/object file(s)
-I update #include/#verbatim files
-k kill alert daemon (piktd)
-K kill service daemon (piktc_svc)
-l list alert/script/program/file/object
file(s)
-L list alert/script/
program/file/object or
host/os/group/alias
command-line item(s)
-m# checksum alert/script/
program/file/object file(s),
where # is checksum level 1-5
-M expand macros
-p# pause # seconds
-Q install PIKT.conf
-r (re)start alert daemon (piktd)
-R (re)start service daemon (piktc_svc)
-s show alert(s) status
-t delete alert/script/program/file/object
/history/log file(s)
-T run in test mode
-U run in urgent mode
-v run in verbose mode
-V show version info
-w view alert/script/program/file/object
actual file(s)
-W view alert/script/program/file/object
authorized file(s)
-x execute alert(s)/script(s)
-X execute alert(s)/script(s) with no wait
-z run in 'make check' mode
-Z list all config elements
+|-D <define(s)> define/undefine define(s)
+|-E <envar(s)> set/unset environment variable(s)
+C <command(s)> include command string(s)
+M <macro(s)> include macro string(s)
+|-A|S[f] all|<alert(s)> include/exclude (fix) alert(s)
+|-P[f] all|<program(s)> include/exclude (fix)
program file(s)
+|-F[f] all|<file(s)> include/exclude (fix)
other file(s)
+|-O[f] all|<object(s)> include/exclude (fix)
object file(s)
+|-H all|<host(s)> include/exclude
host(s)/os(es)/group(s)/alias(es)
ALL +A all +S all +P all
+F all +O all +H all
For more examples, see Samples.