{"id":1277,"date":"2024-09-11T17:45:52","date_gmt":"2024-09-11T09:45:52","guid":{"rendered":"http:\/\/www.rchen.top\/?p=1277"},"modified":"2026-06-17T23:52:18","modified_gmt":"2026-06-17T15:52:18","slug":"%e6%b5%8b%e8%af%95","status":"publish","type":"post","link":"https:\/\/www.rchen.top\/?p=1277","title":{"rendered":"\u4e3alinux(GUI)\u7528\u6237\u63a8\u9001\u5b58\u50a8quota\u6d88\u606f"},"content":{"rendered":"<p><strong>\u9700\u6c42\uff1a<\/strong><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u5bf9\u4e8elinux(EDA)\u7528\u6237\uff0c\u6211\u4eec\u4f1a\u5f00\u542fdisk quota\u914d\u989d,\u6765\u9632\u6b62\u7528\u6237\u8fc7\u5ea6\u6d88\u8017\u5b58\u50a8\u8d44\u6e90\uff0c\u4f46\u662f\u4e00\u65e6\u7528\u6237\u8d85\u989d\u6216\u5373\u5c06\u8d85\u989d\u4f1a\u5bfc\u81f4disk\u6ee1\u65e0\u6cd5\u8fdb\u884c\u4f5c\u4e1a\uff0c\u6211\u4eec\u901a\u8fc7\u914d\u7f6edisk quota\u7684\u544a\u8b66\u63d0\u793a\u6d88\u606f\uff0c\u81ea\u52a8\u544a\u77e5\u7528\u6237\u8fdb\u884cdisk\u6e05\u7406<\/p>\n<p><strong>\u601d\u8def\uff1a<\/strong><\/p>\n<ol type=\"1\">\n<li value=\"1\"><span lang=\"zh-CN\">\u811a\u672c\u83b7\u53d6\u5b58\u50a8\uff08<\/span><span lang=\"en-US\">netapp<\/span><span lang=\"zh-CN\">\uff0c<\/span><span lang=\"en-US\">isilon<\/span><span lang=\"zh-CN\">\uff09\u914d\u989d\u8d85\u9650\u7528\u6237\uff0c<\/span><span lang=\"en-US\">USERID<\/span><span lang=\"zh-CN\">\uff0c<\/span><span lang=\"en-US\">LIMIT<\/span><span lang=\"zh-CN\">\uff0c<\/span><span lang=\"en-US\">USED<\/span><span lang=\"zh-CN\">\uff0c<\/span><span lang=\"en-US\">PATH<\/span><span lang=\"zh-CN\">\u4fe1\u606f<\/span><span lang=\"en-US\">,<\/span>\n<ol type=\"a\">\n<li lang=\"en-US\" value=\"1\">yum install -y sshpass<\/li>\n<li><span lang=\"en-US\">Isilon<\/span><span lang=\"zh-CN\">\u4e0a\u9700\u5f00\u542f<\/span><span lang=\"en-US\">soft limt<\/span><span lang=\"zh-CN\">\u529f\u80fd\uff0c\u901a\u8fc7<\/span><span lang=\"en-US\">exceeded<\/span><span lang=\"zh-CN\">\u547d\u4ee4\u81ea\u52a8\u7b5b\u9009\u51fa\u7528\u6237<\/span><\/li>\n<li><span lang=\"en-US\">netapp<\/span><span lang=\"zh-CN\">\u4e0a\u9700\u8981\u901a\u8fc7\u5faa\u73af\u547d\u4ee4\u68c0\u7d22\u51fa\u7528\u6237<\/span><\/li>\n<li><span lang=\"zh-CN\">\u811a\u672c\uff0c<\/span> <span lang=\"zh-CN\">user_quota_exceeded_list.sh<\/span><\/li>\n<\/ol>\n<\/li>\n<li><span lang=\"zh-CN\">\u83b7\u53d6\u8d85\u989d\u7528\u6237\u5217\u8868\uff0c\u7528\u6237\u5df2\u767b\u5f55\u5219\u6267\u884c<\/span><span lang=\"en-US\">notify-send<\/span><span lang=\"zh-CN\">\u811a\u672c\uff0c<\/span>\n<ol type=\"a\">\n<li value=\"1\">\u811a\u672c\uff0cquota_notify.sh<\/li>\n<\/ol>\n<\/li>\n<li><span lang=\"zh-CN\">\u914d\u7f6e\u8be5\u7528\u6237\u7684<\/span><span lang=\"en-US\">DISPLAY<\/span><span lang=\"en-US\">\u53d8\u91cf\uff0c\u4ee5\u4fbf<\/span><span lang=\"en-US\">notify-send<\/span><span lang=\"en-US\">\u53d1\u9001\u5f39\u7a97\u901a\u77e5 <\/span>\n<ol type=\"a\">\n<li value=\"1\">\u811a\u672c\uff0cuser_quota_notify.sh<\/li>\n<\/ol>\n<\/li>\n<li><span lang=\"zh-CN\">\u7edf\u8ba1\u8d85\u989d\u7528\u6237<\/span><span lang=\"en-US\">quota<\/span><span lang=\"zh-CN\">\u751f\u6210\u5217\u8868\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0a\u63a8\u9001<\/span>\n<ol type=\"a\">\n<li value=\"1\">\u811a\u672c\uff0cmain.sh<\/li>\n<\/ol>\n<\/li>\n<li>\u6548\u679c\u5c55\u793a\uff1a<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"579\" class=\"alignnone wp-image-1279 size-full\" src=\"http:\/\/www.rchen.top\/wp-content\/uploads\/2024\/09\/Pasted-5.png\" \/><\/p>\n<p><strong>main.sh<\/strong><\/p>\n<p>#!\/bin\/bash<\/p>\n<p>#\u7edf\u8ba1\u8d85\u989d\u7528\u6237quota\u751f\u6210\u5217\u8868<\/p>\n<p>\/xxx\/storage_quota_notify\/user_quota_exceeded_list.sh &gt; \/xxx\/storage_quota_notify\/quota_exceeded_list_verbose<\/p>\n<p>grep &#8216;user&#8217; \/xxx\/storage_quota_notify\/quota_exceeded_list_verbose | awk &#8216;{printf &#8220;%-20s %-20s %-20s %-20s %-20s\\n&#8221;,$1,$2,$3,$4,$5}&#8217; &gt; \/xxx\/storage_<\/p>\n<p>quota_notify\/quota_exceeded_list<\/p>\n<p>#\u6267\u884c\u811a\u672cquota_notify\u811a\u672c<\/p>\n<p>\/xxx\/storage_quota_notify\/quota_notify.sh<\/p>\n<p><strong>user_quota_exceeded_list.sh<\/strong><\/p>\n<p>#!\/bin\/bash<\/p>\n<p># SSH\u8fde\u63a5\u4fe1\u606f<\/p>\n<p>username=&#8221;xxx&#8221;<\/p>\n<p>password=&#8221;xxxx&#8221;<\/p>\n<p>netapp_host=&#8221;xxx&#8221;<\/p>\n<p>isilon_host=&#8221;xxx&#8221;<\/p>\n<p># \u5faa\u73af\u66ff\u6362\u767e\u5206\u6bd4\u503c\u5e76\u6267\u884c\u547d\u4ee4<\/p>\n<p>for i in {91..99}; do<\/p>\n<p># netapp quota\u547d\u4ee4<\/p>\n<p>netapp_quota_command=&#8221;quota report -disk-used-pct-disk-limit ${i}%&#8221;<\/p>\n<p># \u4f7f\u7528sshpass\u6267\u884cSSH\u547d\u4ee4<\/p>\n<p>output1=$(sshpass -p &#8220;$password&#8221; ssh $username@$netapp_host &#8220;$netapp_quota_command&#8221;| awk &#8216;{print $2, $3, $1, $5, $4}&#8217;)<\/p>\n<p># \u8f93\u51fa\u6bcf\u6b21\u6267\u884c\u7684\u7ed3\u679c<\/p>\n<p>echo &#8220;\u78c1\u76d8\u4f7f\u7528\u767e\u5206\u6bd4\u4e3a ${i}% \u7684\u7ed3\u679c\uff1a&#8221;<\/p>\n<p>echo &#8220;$output1&#8221;<\/p>\n<p>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8220;<\/p>\n<p>done<\/p>\n<p># isilon quota\u547d\u4ee4<\/p>\n<p>isilon_quota_command=&#8221;isi quota list\u00a0 &#8211;exceeded &#8211;no-footer -v&#8221;<\/p>\n<p># \u4f7f\u7528sshpass\u6267\u884cSSH\u547d\u4ee4<\/p>\n<p>output2=$(sshpass -p &#8220;$password&#8221; ssh $username@$isilon_host &#8220;$isilon_quota_command&#8221; | awk &#8216;{print $1, $2, $3, $5, $12}&#8217;| awk &#8216;{gsub(&#8220;\/ifs\/&#8221;, &#8220;&#8221;); print}&#8217;)<\/p>\n<p># \u8f93\u51fa\u6bcf\u6b21\u6267\u884c\u7684\u7ed3\u679c<\/p>\n<p>echo &#8220;isilon \u78c1\u76d8quota\u4f7f\u7528\u7684\u7ed3\u679c\uff1a&#8221;<\/p>\n<p>echo &#8220;$output2&#8221;<\/p>\n<p>echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8220;<\/p>\n<p><strong>quota_notify.sh<\/strong><\/p>\n<p>#!\/bin\/bash<\/p>\n<p>#\u83b7\u53d6\u8d85\u989d\u7528\u6237\u5217\u8868<\/p>\n<p>user_list=$(awk &#8216;{print $2}&#8217; \/xxx\/storage_quota_notify\/quota_exceeded_list)<\/p>\n<p>for user in $user_list;do<\/p>\n<p>#\u7528\u6237\u5df2\u767b\u5f55\u5219\u6267\u884c\u811a\u672c<\/p>\n<p>who |grep $user &amp;&gt;&gt;\/dev\/null &amp;&amp;\u00a0\u00a0\u00a0 su $user -c &#8220;\/xxx\/storage_quota_notify\/user_quota_notify.sh&#8221;<\/p>\n<p>done<\/p>\n<p><strong>user_quota_notify.sh<\/strong><\/p>\n<p>#!\/bin\/bash<\/p>\n<p>#\u914d\u7f6e\u8be5\u7528\u6237\u7684DISPLAY\u53d8\u91cf\uff0c\u4ee5\u4fbfnotify-send\u53d1\u9001\u5f39\u7a97\u901a\u77e5<\/p>\n<p>export DISPLAY=$(who |grep $USER |tail -n1 |grep -oP &#8216;\\(\\K[^)]+&#8217;)<\/p>\n<p>#\u53d1\u9001DISPLAY\u901a\u77e5<\/p>\n<p>grep\u00a0 $USER \/xxx\/storage_quota_notify\/quota_exceeded_list |awk &#8216;{print &#8220;Your directory &#8221; $3 &#8221; has exceeded the quota&#8221; &#8220;(Limit:&#8221; $4 &#8220;, Used:&#8221; $5 &#8220;). Please clean up the useless files in this directory in time, otherwise writing will be prohibited.&#8221;}&#8217; |xargs\u00a0 -i notify-send -u critical &#8220;Storage quota exceeded&#8221; &#8220;<\/p>\n<p>{}&#8221;<\/p>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42\uff1a \u00a0 \u00a0 \u00a0 \u5bf9\u4e8elinux(EDA)\u7528\u6237\uff0c\u6211\u4eec\u4f1a\u5f00\u542fdisk quota\u914d\u989d,\u6765\u9632\u6b62\u7528\u6237\u8fc7\u5ea6\u6d88\u8017\u5b58\u50a8\u8d44 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":473,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[133,36,88],"tags":[107,14,22],"class_list":["post-1277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-eda","category-linux","category-hpc","tag-eda","tag-linux","tag-22"],"_links":{"self":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/1277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1277"}],"version-history":[{"count":4,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/1277\/revisions"}],"predecessor-version":[{"id":1518,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/posts\/1277\/revisions\/1518"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=\/wp\/v2\/media\/473"}],"wp:attachment":[{"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rchen.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}