Created
February 2, 2012 11:05
-
-
Save snickerjp/1722914 to your computer and use it in GitHub Desktop.
Perlで置換
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/nagios/nrpe.cfg.`date '+%Y%m%d'` |perl -e 'foreach(<>){ if(!/^#/ && /check_disk/){ s/check_disk -w \$ARG1\$ -c \$ARG2\$/check_disk -w \$ARG1\$ -c \$ARG2\$ -W \$ARG1\$ -K \$ARG2\$/; } print;}' > /etc/nagios/nrpe.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /etc/nagios/nrpe.cfg.`date '+%Y%m%d'` |perl -e 'foreach(<>){ if(!/^#/ && /check_disk/){ s/check_disk\s+-w \$ARG1\$ -c \$ARG2\$/check_disk -w \$ARG1\$ -c \$ARG2\$ -W \$ARG1\$ -K \$ARG2\$/; } print;}' > /etc/nagios/nrpe.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -e 's/check_disk -w \$ARG1\$ -c \$ARG2\$/check_disk -w $ARG1$ -c $ARG2$ -W $ARG1$ -K $ARG2$/' \ | |
/etc/nagios/nrpe.cfg.`date '+%Y%m%d'` > /etc/nagios/nrpe.cfg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp -p /etc/nagios/nrpe.cfg /etc/nagios/nrpe.cfg.`date '+%Y%m%d'` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment