
bashスクリプトで簡単に使用できるツールがあるかどうか知りたいのですが操作する(追加、削除、更新) ディレクティブを conf ファイル内に記述しますか?
たとえば、fail2ban.conf にはグループ化されたディレクティブがあり、それぞれが独自のセクションの下にあります。
[proftpd]
enabled = true
port = ftp,ftp-data,ftps,ftps-data
[postfix]
enabled = true
port = smtp,465,submission
一方、pagespeed.conf には混合ディレクティブがあり、一部は独自のセクションにあり、一部はあちこちに配列されています。
<Location /pagespeed_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler pagespeed_admin
</Location>
<Location /pagespeed_global_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler pagespeed_global_admin
</Location>
ModPagespeedMessageBufferSize 100000
ModPagespeedStatisticsLogging on
ModPagespeedEnableCachePurge on
ModPagespeedPurgeMethod PURGE
ModPagespeedFileCacheSizeKb 2048000
ModPagespeedFileCacheCleanIntervalMs 3600000
ModPagespeedFileCacheInodeLimit 500000
分かりました。
たとえば、fail2ban.conf の 'proftpd' セクションの 'enabled' ディレクティブを操作できるツールはありますか?
または、pagespeed.conf の 'Location /pagespeed_admin' セクションの 'Allow from' ディレクティブを操作しますか?
または、pagespeed.conf の「no particular」セクションにある「ModPagespeedMessageBufferSize」ディレクティブを操作しますか?
ありがとう
答え1
いいえ、その理由は単純で、設定ファイルで使用できる形式が多すぎるからです。最善の方法は、テキスト処理ツールを使用して独自の形式を作成することだと思います。
いくつかの形式 (たとえば JSON) 用のライブラリがあるかもしれませんが、ツールの作成者は好きな形式を自由に使用できるため、汎用ツールは不可能です。この点を説明するために、いくつかの conf ファイルからいくつかの行を次に示します。
エマック
;; Are we running XEmacs or Emacs? (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) ;; disable menu bar when running in terminal (when (not (display-graphic-p)) (menu-bar-mode -1)) ;;My libraries, ebib, wordcount etc (add-to-list 'load-path "~/.emacs-lisp/")
6 六
highlight Normal guibg=grey90 highlight Cursor guibg=Green guifg=NONE highlight lCursor guibg=Cyan guifg=NONE highlight NonText guibg=grey80 highlight Constant gui=NONE guibg=grey95 highlight Special gui=NONE guibg=grey95
色合い
#--------------------------------------------- # BACKGROUND AND BORDER #--------------------------------------------- # general panel settings rounded = 7 border_width = 2 #background_color = #B4B2B2 10 background_color = #000000 30 border_color = #8F0004 0
動画
# Trigger button (string) #gestures-button=left [motion] # motion control interface [oldrc] # Remote control interface # Show stream position (boolean) rc-show-pos=0
sshd
AuthorizedKeysFile .ssh/authorized_keys ChallengeResponseAuthentication no UsePAM yes
などなど。
答え2
実際にはそうではありませんが、特定の構成レイアウト用に何かを構築することができます。
sed -E "/\[proftpd]/,/\[/{s/(enabled\s*=\s*).*/\1false/}" input.file
たとえば、fail2ban.conf を変更する関数として設計できます。
興味があれば拡張することもできます。