{"id":30,"date":"2020-02-24T07:47:05","date_gmt":"2020-02-24T07:47:05","guid":{"rendered":"http:\/\/untanux.lt\/?p=30"},"modified":"2020-02-24T07:47:05","modified_gmt":"2020-02-24T07:47:05","slug":"vmware-linux-vm-cpu-and-ram-hot-plug-script","status":"publish","type":"post","link":"https:\/\/untanux.lt\/?p=30","title":{"rendered":"VMware linux VM CPU and RAM hot-plug script"},"content":{"rendered":"\n<p>The script below will turn all CPU and RAM online for you. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n# Based on script by William Lam - http:\/\/engineering.ucsb.edu\/~duonglt\/vmware\/\n\n# Bring CPUs online\nfor CPU_DIR in \/sys\/devices\/system\/cpu\/cpu[0-9]*\ndo\n    CPU=${CPU_DIR##*\/}\n    echo \"Found cpu: '${CPU_DIR}' ...\"\n    CPU_STATE_FILE=\"${CPU_DIR}\/online\"\n    if [ -f \"${CPU_STATE_FILE}\" ]; then\n        if grep -qx 1 \"${CPU_STATE_FILE}\"; then\n            echo -e \"\\t${CPU} already online\"\n        else\n            echo -e \"\\t${CPU} is new cpu, onlining cpu ...\"\n            echo 1 > \"${CPU_STATE_FILE}\"\n        fi\n    else \n        echo -e \"\\t${CPU} already configured prior to hot-add\"\n    fi\ndone\n\n# Bring all new Memory online\nfor RAM in $(grep line \/sys\/devices\/system\/memory\/*\/state)\ndo\n    echo \"Found ram: ${RAM} ...\"\n    if [[ \"${RAM}\" == *\":offline\" ]]; then\n        echo \"Bringing online\"\n        echo $RAM | sed \"s\/:offline$\/\/\"|sed \"s\/^\/echo online > \/\"|source \/dev\/stdin\n    else\n        echo \"Already online\"\n    fi\ndone<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The script below will turn all CPU and RAM online for you.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/untanux.lt\/index.php?rest_route=\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/untanux.lt\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/untanux.lt\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/untanux.lt\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/untanux.lt\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30"}],"version-history":[{"count":0,"href":"https:\/\/untanux.lt\/index.php?rest_route=\/wp\/v2\/posts\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/untanux.lt\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/untanux.lt\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/untanux.lt\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}