FOXBI

DSM 5.x/6.x CPU name & cores infomation Change tool

Recommended Posts

1 hour ago, kacy said:

Thank you, FOXBI!

Can you publish last version shell script?

 

 

I am not a professional developer

 

I am a bit embarrassed every time I release the source ,, :36_flushed:

 

Please see below.

 

 

Spoiler

#!/bin/bash
# ver 4.0 2018.09.13 Made by FOXBI
# ver 3.0 2018.08.24 Made by FOXBI
# Ver 1.5 2018.08.23 Made by FOXBI
# Ver 1.1 2018.08.22 Made by FOXBI
# Ver 1.0 2018.08.17 Made by FOXBI
ver="4.0"
# ==============================================================================
# Y or N Function
# ==============================================================================
READ_YN () { # $1:question $2:default
   read -n1 -p "$1" Y_N
    case "$Y_N" in
    y) Y_N="y"
         echo -e "\n" ;;
    n) Y_N="n"
         echo -e "\n" ;;        
    q) echo -e "\n"
       exit 0 ;;
    *) echo -e "\n" ;;
    esac
}

# ==============================================================================
# Process Function
# ==============================================================================
PREPARE_FN () {
    if [ -f "$WORK_DIR/admin_center.js" ] && [ -f "$MWORK_DIR/mobile.js" ]
    then
        if [ "$direct_job" == "y" ]
        then
            echo "warning!! Work directly on the original file without backup.\n"
        else
            cd $WORK_DIR
            tar -cf $BKUP_DIR/$TIME/admin_center.tar admin_center.js*
            cd $MWORK_DIR
            tar -cf $BKUP_DIR/$TIME/mobile.tar mobile.js*
        fi
        if [ "$MA_VER" -eq "6" ] && [ "$MI_VER" -ge "2" ]
        then
            mv $WORK_DIR/admin_center.js.gz $BKUP_DIR/
            mv $MWORK_DIR/mobile.js.gz $BKUP_DIR/
	        cd $BKUP_DIR/
            gzip -df $BKUP_DIR/admin_center.js.gz 
            gzip -df $BKUP_DIR/mobile.js.gz        
        else
            cp -Rf $WORK_DIR/admin_center.js $BKUP_DIR/
            cp -Rf $MWORK_DIR/mobile.js $BKUP_DIR/
        fi
    else
        COMMENT08_FN
    fi
}

GATHER_FN () {
    DMI_CHK=`dmidecode | grep 'SMBIOS' | egrep 'NO|sorry' | wc -l`
    if [ "$DMI_CHK" -gt "0" ]
    then
        cpu_vendor=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $4}'`
        if [ "$cpu_vendor" == "AMD" ]
        then
            cpu_family=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk -F "$cpu_vendor " '{ print $2 }' | awk -F "Processor" '{ print $1 }'`
            cpu_series=""
        else
            cpu_family=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $5}'`        
            cpu_series=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{ if (index($7,"@")!=0) { print $6 } else { print $6" "$7 } }'`
        fi        
    else
        cpu_vendor=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $2}'`
        if [ "$cpu_vendor" == "AMD" ]
        then
            cpu_family=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk -F "$cpu_vendor " '{ print $2 }' | awk -F "Processor" '{ print $1 }'`
            cpu_series=""
        else
            cpu_family=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $3}'`        
            cpu_series=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{ if (index($5,"@")!=0) { print $4 } else { print $4" "$5 } }'`
        fi
    fi
    cpu_cores=`cat /proc/cpuinfo | grep processor| wc -l`
}

PERFORM_FN () {
    if [ -f "$BKUP_DIR/admin_center.js" ] && [ -f "$BKUP_DIR/mobile.js" ]
    then    
        if [ "$MA_VER" -ge "6" ]
        then
            cpu_info=`echo "f.cpu_vendor=\"${cpu_vendor}\";f.cpu_family=\"${cpu_family}\";f.cpu_series=\"${cpu_series}\";f.cpu_cores=\"${cpu_cores}\";"`
            sed -i "s/f.model]);/f.model]);${cpu_info}/g" $BKUP_DIR/admin_center.js

            cpu_info_m=`echo "{name: \"cpu_series\",renderer: function(value){var cpu_vendor=\"${cpu_vendor}\";var cpu_family=\"${cpu_family}\";var cpu_series=\"${cpu_series}\";var cpu_cores=\"${cpu_cores}\";return Ext.String.format('{0} {1} {2} ({3}Core)', cpu_vendor, cpu_family, cpu_series, cpu_cores);},label: _T(\"status\", \"cpu_model_name\")},"`
            sed -i "s/\"ds_model\")},/\"ds_model\")},${cpu_info_m}/g" $BKUP_DIR/mobile.js
        else
            if [ "$MI_VER" -gt "0" ]
            then
                cpu_info=`echo "b.cpu_vendor=\"${cpu_vendor}\";b.cpu_family=\"${cpu_family}\";b.cpu_series=\"${cpu_series}\";b.cpu_cores=\"${cpu_cores}\";"`
            else
                cpu_info=`echo "b.cpu_vendor=\"${cpu_vendor}\";b.cpu_family=\"${cpu_family} ${cpu_series}\";b.cpu_cores=\"${cpu_cores}\";"`
            fi
            sed -i "s/b.model]);/b.model]);${cpu_info}/g" $BKUP_DIR/admin_center.js
        fi
    else
        COMMENT08_FN
    fi
}

APPLY_FN () {
    if [ -f "$BKUP_DIR/admin_center.js" ] && [ -f "$BKUP_DIR/mobile.js" ]
    then    
        cp -Rf $BKUP_DIR/admin_center.js $WORK_DIR/
        cp -Rf $BKUP_DIR/mobile.js $MWORK_DIR/
        if [ "$MA_VER" -eq "6" ] && [ "$MI_VER" -ge "2" ]
        then    
            gzip -f $BKUP_DIR/admin_center.js
            gzip -f $BKUP_DIR/mobile.js
            mv $BKUP_DIR/admin_center.js.gz $WORK_DIR/
            mv $BKUP_DIR/mobile.js.gz $MWORK_DIR/
        else
            rm -rf $BKUP_DIR/admin_center.js
            rm -rf $BKUP_DIR/mobile.js
        fi
    else
        COMMENT08_FN
    fi        
}

RECOVER_FN () {
    if [ -d "$BKUP_DIR/$TIME" ]
    then
        cd $WORK_DIR
        tar -xf $BKUP_DIR/$TIME/admin_center.tar
        if [ -f "$BKUP_DIR/$TIME/mobile.tar" ]
        then
            cd $MWORK_DIR
            tar -xf $BKUP_DIR/$TIME/mobile.tar
        fi
        if [ "$re_check" == "y" ]
        then
            echo -e "Restore to source and continue.\n"
        else
            COMMENT09_FN
        fi
    else
        COMMENT08_FN
    fi
}

RERUN_FN () {
    if [ "$1" == "redo" ]
    then
        ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | awk '{print "rm -rf '$BKUP_DIR'/"$9}' | sh
        GATHER_FN
        if [ -f "$WORK_DIR/admin_center.js" ] && [ -f "$MWORK_DIR/mobile.js" ]
        then
            info_cnt=`cat $WORK_DIR/admin_center.js | grep ".model]);if(Ext.isDefined" | wc -l`
            info_cnt_m=`cat $MWORK_DIR/mobile.js | grep "ds_model\")},{name:\"ram_size" | wc -l`
            if [ "$info_cnt" -eq "0" ] && [ "$info_cnt_m" -eq "0" ]
            then
                if [ "$MA_VER" -ge "6" ]
                then
                    cpu_info="f.cpu_vendor=\\\"${cpu_vendor}\\\";f.cpu_family=\\\"${cpu_family}\\\";f.cpu_series=\\\"${cpu_series}\\\";f.cpu_cores=\\\"${cpu_cores}\\\";"
                    sed -i "s/${cpu_info}//g" $WORK_DIR/admin_center.js

                    cpu_info_m="{name: \\\"cpu_series\\\",renderer: function(value){var cpu_vendor=\\\"${cpu_vendor}\\\";var cpu_family=\\\"${cpu_family}\\\";var cpu_series=\\\"${cpu_series}\\\";var cpu_cores=\\\"${cpu_cores}\\\";return Ext.String.format('{0} {1} {2} ({3}Core)', cpu_vendor, cpu_family, cpu_series, cpu_cores);},label: _T(\\\"status\\\", \\\"cpu_model_name\\\")},"
                    sed -i "s/${cpu_info_m}//g" $MWORK_DIR/mobile.js                    
                    if [ "$MI_VER" -ge "2" ]
                    then
                        cp -Rf $WORK_DIR/admin_center.js $WORK_DIR/admin_center.js.1
                        cp -Rf $MWORK_DIR/mobile.js $MWORK_DIR/mobile.js.1
                        gzip -f $WORK_DIR/admin_center.js
                        gzip -f $MWORK_DIR/mobile.js
                        mv $WORK_DIR/admin_center.js.1 $WORK_DIR/admin_center.js
                        mv $MWORK_DIR/mobile.js.1 $MWORK_DIR/mobile.js
                    fi
                else
                    if [ "$MI_VER" -gt "0" ]
                    then
                        cpu_info="b.cpu_vendor=\\\"${cpu_vendor}\\\";b.cpu_family=\\\"${cpu_family}\\\";b.cpu_series=\\\"${cpu_series}\\\";b.cpu_cores=\\\"${cpu_cores}\\\";"
                    else
                        cpu_info="b.cpu_vendor=\\\"${cpu_vendor}\\\";b.cpu_family=\\\"${cpu_family} ${cpu_series}\\\";b.cpu_cores=\\\"${cpu_cores}\\\";"
                    fi
                    sed -i "s/${cpu_info}//g" $WORK_DIR/admin_center.js
                fi
            fi
        else
            COMMENT08_FN
        fi    
    fi
}

BLCHECK_FN () {
    bl_check=n
    if [ -d "$BKUP_DIR" ]
    then
        BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | wc -l`
        if [ "$BK_CNT" -gt "0" ]
        then
            BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep "$BL_CHK" | wc -l`
            if [ "$BK_CNT" -gt "0" ]
            then
                TIME=`ls -l $BKUP_DIR/ | grep ^d | grep "$BL_CHK" | awk '{print $9}' | head -1`
                BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | wc -l`
                if [ "$BK_CNT" -gt "0" ]
                then
                    BLSUB_FN "$1"
                else
                    if [ "$re_check" == "n" ]
                    then
                        if [ "$1" == "run" ]
                        then
                            COMMENT03_FN
                        fi
                        COMMENT05_FN
                    else
                        STIME=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1`
                        BLSUB_FN "redo"
                    fi
                fi
            else
                if [ "$1" == "restore" ]
                then
                    COMMENT07_FN
                fi
                BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | wc -l`
                if [ "$BK_CNT" -gt "0" ]
                then
                    BL_COM=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1 | awk -F_ '{print $2}'`
                    BL_CNT=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1 | awk -F_ '{print $2}' | wc -l`
                    if [ "$BL_COM" == "" ]
                    then
                        if [ "$BL_CNT" -gt "0" ]
                        then
                            BLSUB_FN "$1"
                            bl_check=y
                        else
                            COMMENT06_FN
                        fi
                    else
                        TIME=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1`
                        if [ "$BL_CHK" == "$BL_COM" ]
                        then
                            if [ "$1" == "run" ]
                            then
                                COMMENT03_FN
                            else
                                COMMENT05_FN
                                bl_check=n
                            fi
                        else
                            if [ "$BL_CHK" -gt "$BL_COM" ]
                            then
                                BLSUB_FN "$1"
                                bl_check=y
                            else
                                COMMENT06_FN
                            fi
                        fi
                    fi
                else
                    COMMENT06_FN
                fi
            fi
        else
            CASE_FN "$1"
        fi
    else
        CASE_FN "$1"
    fi
}

BLSUB_FN () {
    TIME=`echo "$STIME"`
    if [ "$1" == "run" ]
    then
        RERUN_FN "redo"
    else
        RERUN_FN "$1"
    fi
    COMMENT05_FN
}

CASE_FN () {
    case "$1" in
        run) COMMENT05_FN ;;
        redo) COMMENT07_FN ;;        
        restore) COMMENT07_FN ;;
        *) COMMENT06_FN ;;
    esac    
}

EXEC_FN () {
if [ -d $WORK_DIR ]
then    
    READ_YN "Auto Excute, If you select n, proceed interactively  (Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]
    then
        mkdir -p $BKUP_DIR/$TIME

        if [ "$re_check" == "y" ]
        then
            if [ "$bl_check" == "y" ]
            then
 		        COMMENT04_FN
            else
                RECOVER_FN
            fi
        fi

        PREPARE_FN

        GATHER_FN

        PERFORM_FN

        APPLY_FN

        COMMENT09_FN

    elif [ "$Y_N" == "n" ]
    then
        READ_YN "Proceed with original file backup and preparation.. If you select n, Work directly on the original file. (Cancel : q) [y/n] : "
        if [ "$Y_N" == "y" ]    
        then
            mkdir -p $BKUP_DIR/$TIME

            if [ "$re_check" == "y" ]
            then
                if [ "$bl_check" == "y" ]
                then
 		            COMMENT04_FN
                else
                    RECOVER_FN
                fi
            fi

            PREPARE_FN

        elif [ "$Y_N" == "n" ]
        then
            direct_job=y
            mkdir -p $BKUP_DIR
            PREPARE_FN            
        else
            COMMENT10_FN
        fi

        READ_YN "CPU name, Core count and reflects it. If you select n, Resote original file (Cancel : q) [y/n] : "
        if [ "$Y_N" == "y" ]    
        then    
            GATHER_FN

            PERFORM_FN

            APPLY_FN

		    COMMENT09_FN
        elif [ "$Y_N" == "n" ]
        then
	        if [ -d "$BKUP_DIR" ]
    	    then
                gzip $BKUP_DIR/admin_center.js
                gzip $BKUP_DIR/mobile.js
                mv $BKUP_DIR/admin_center.js.gz $WORK_DIR/
                mv $BKUP_DIR/mobile.js.gz $MWORK_DIR/
                COMMENT09_FN
		    else
			    COMMENT07_FN
		    fi
        else
            COMMENT10_FN
        fi
    else
        COMMENT10_FN
    fi
else
    COMMENT08_FN
fi
}

COMMENT03_FN () {
    echo -e "There is a history of running the same version. Please run again select 2) redo .\n"
    exit 0
}

COMMENT04_FN () {
    echo -e "Do not restore to source when installing a higher version. Contiue...\n"
}

COMMENT05_FN () {
    echo -e "You have verified and installed the previous version. Contiue...\n"
}

COMMENT06_FN () {
    echo -e "Problem and exit. Please run again after checking."
    exit 0    
}

COMMENT07_FN () {
    echo -e "No execution history. Please go back to the first run."
    exit 0
}

COMMENT08_FN () {
    echo -e "The target file(location) does not exist. Please run again after checking."
    exit 0
}

COMMENT09_FN () {
    echo -e "The operation is complete!! It takes about 1-2 minutes to reflect, \n(Please refresh the DSM page with F5 or after logout/login and check the information.)"
    exit 0
}

COMMENT10_FN () {
    echo -e "Only y / n / q can be input. Please proceed again."
    exit 0
}

# ==============================================================================
# Main Progress
# ==============================================================================
clear
WORK_DIR="/usr/syno/synoman/webman/modules/AdminCenter"
MWORK_DIR="/usr/syno/synoman/mobile/ui"
BKUP_DIR="/root/Xpenology_backup"
VER_DIR="/etc.default"

echo "DSM CPU Information Change Tool ver. \033[0;31m"$ver"\033[00m - made by FOXBI\n"

if [ -d "$VER_DIR" ]
then
    VER_FIL="$VER_DIR/VERSION"
else
    VER_FIL="/etc/VERSION"
fi

if [ -f "$VER_FIL" ]
then
    MA_VER=`cat $VER_FIL | grep majorversion | awk -F \= '{print $2}' | sed 's/\"//g'`
    MI_VER=`cat $VER_FIL | grep minorversion | awk -F \= '{print $2}' | sed 's/\"//g'`
    BL_NUM=`cat $VER_FIL | grep buildnumber | awk -F \= '{print $2}' | sed 's/\"//g'`    
    BL_FIX=`cat $VER_FIL | grep smallfixnumber | awk -F \= '{print $2}' | sed 's/\"//g'`
else
    COMMENT08_FN
fi

BL_CHK=$BL_NUM$BL_FIX
TIME=`date +%Y%m%d%H%M%S`"_"$BL_CHK
STIME=`echo "$TIME"`

if [ "$MA_VER" -gt "4" ]
then
    if [ "$MA_VER" -eq "5" ]
    then
        MWORK_DIR="/usr/syno/synoman/webman/mapp"
    fi
    echo "Your version of DSM is \033[0;36mDSM \033[0;31m"$MA_VER"."$MI_VER"\033[0;32m continue...\n"
else
    echo "DSM version less than 5 is not supported. End the process."
    exit 0
fi

read -n1 -p "1) First run  2) Redo  3) Restore - Select Number : " inst_z 
   case "$inst_z" in
   1) inst_check=run 
      echo -e "\n " ;;
   2) inst_check=redo 
      echo -e "\n " ;;
   3) inst_check=restore 
      echo -e "\n " ;;
   *) echo -e "\n" ;;
   esac

if [ "$inst_check" == "redo" ]
then
	READ_YN "Do you want to proceed again? Restore to original file backup and proceed.(Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]    
    then
        re_check=y        
        BLCHECK_FN "$inst_check"
        inst_check=run
        EXEC_FN
    elif [ "$Y_N" == "n" ]
    then
        echo "Do not proceed with the redo."    
    else
        COMMENT10_FN
    fi
elif [ "$inst_check" == "restore" ]
then
	READ_YN "Do you want to restore using the original backup file? (Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]    
    then
        re_check=n
        BLCHECK_FN "$inst_check"
        RECOVER_FN
    elif [ "$Y_N" == "n" ]
    then
        echo "No restore was performed."   
    else
        COMMENT10_FN
    fi
elif [ "$inst_check" == "run" ]
then
    re_check=n
    BLCHECK_FN "$inst_check"
    EXEC_FN
else
    echo "Please select the correct number."
fi

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Many thanks, FOXBI!
The shell script works great!
PS  I recently had a trip to Korea. Korea is a beautiful country populated by wonderful people.

  • Thanks 1

Share this post


Link to post
Share on other sites

As the binary cannot be downloaded, I've made a cpu_info file by pasting your code into it.

Copied to a temp folder on my XPEnology NAS. Then set executable attribute, but could only execute via sh command, then I get an error message.

 

root@FORESTER:/volume1/tibor/Temp# sh cpu_info
cpu_info: line 13: syntax error near unexpected token `$'in\r''
'pu_info: line 13: `    case "$Y_N" in


What did I wrong? I have DSM 6.2-23739 if that matters (don't think so).

  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/10/2018 at 1:25 PM, Tibor said:

As the binary cannot be downloaded, I've made a cpu_info file by pasting your code into it.

Copied to a temp folder on my XPEnology NAS. Then set executable attribute, but could only execute via sh command, then I get an error message.

 

root@FORESTER:/volume1/tibor/Temp# sh cpu_info
cpu_info: line 13: syntax error near unexpected token `$'in\r''
'pu_info: line 13: `    case "$Y_N" in
 

What did I wrong? I have DSM 6.2-23739 if that matters (don't think so).

 

 

Hello,

 

Why are not attachments being downloaded? 

Please contact the forum administrator.

 

It may not be a problem in your shell environment or in the pasting process.

Please try debugging with

#sh -x cpu_info 

You can see at a glance where the error occurs.

If you show me the results, I will look for problems together.

Share this post


Link to post
Share on other sites
On 10/11/2018 at 8:43 AM, FOXBI said:

 

Hello,

 

Why are not attachments being downloaded? 

Please contact the forum administrator.

 

 

It may not be a problem in your shell environment or in the pasting process.

Please try debugging with


#sh -x cpu_info 

You can see at a glance where the error occurs.

If you show me the results, I will look for problems together.

 

As of the debug info

root@FORESTER:/volume1/tibor/Temp# sh -x cpu_info
+ ver=$'4.0\r'
cpu_info: line 13: syntax error near unexpected token `$'in\r''
'pu_info: line 13: `    case "$Y_N" in

I tried to download the binary again, this I could. Don't know why couldn't last time. I don't have luck with you script :)

Executed like this and got that message:

root@FORESTER:/volume1/tibor/Temp# ./ch_cpuinfo
-ash: ./ch_cpuinfo: Text file busy

What text filie might be busy?  I'm in the middle of expanding my volume (running for a day now, but it's still at 36%), otherwise it's a new system, it's quite empty, no big packages running, etc.

 

I have not expectations, you're kind already that took the time, made the script and publish it for so many people's delight :)

  • Thanks 1

Share this post


Link to post
Share on other sites
19 hours ago, Tibor said:

+ ver=$'4.0\r'
cpu_info: line 13: syntax error near unexpected token `$'in\r''

 

I think so happen problem, when you pasted shell source.

 

original source not include \r 

 

Perhaps it seems that \r has been inserted in the line change during the pasting process.

 

 

It is possible that some terminal programs may occur. Please compress the source created by notepad, upload & unzip it, and try to execute it

 

gook luck :)

 

Share this post


Link to post
Share on other sites

Cool, it was probalby my mistake. I've downloaded again, set the permissions properly, executed and voila, it did work as it should :)DSM.thumb.PNG.3ebfdb3bac2045242fa54fd4e2e2961f.PNG

  • Thanks 1

Share this post


Link to post
Share on other sites

@FOXBI It seems, that don't work on 6.2.1 with 1.04b loader.

 

UPD: After reboot - ok.

Edited by Olegin
  • Thanks 1

Share this post


Link to post
Share on other sites
On 9/16/2018 at 5:23 PM, FOXBI said:

 

 

I am not a professional developer

 

I am a bit embarrassed every time I release the source ,, :36_flushed:

 

Please see below.

 

 

  ch_cpuinfo Ver. 4.0 (Reveal hidden contents)


#!/bin/bash
# ver 4.0 2018.09.13 Made by FOXBI
# ver 3.0 2018.08.24 Made by FOXBI
# Ver 1.5 2018.08.23 Made by FOXBI
# Ver 1.1 2018.08.22 Made by FOXBI
# Ver 1.0 2018.08.17 Made by FOXBI
ver="4.0"
# ==============================================================================
# Y or N Function
# ==============================================================================
READ_YN () { # $1:question $2:default
   read -n1 -p "$1" Y_N
    case "$Y_N" in
    y) Y_N="y"
         echo -e "\n" ;;
    n) Y_N="n"
         echo -e "\n" ;;        
    q) echo -e "\n"
       exit 0 ;;
    *) echo -e "\n" ;;
    esac
}

# ==============================================================================
# Process Function
# ==============================================================================
PREPARE_FN () {
    if [ -f "$WORK_DIR/admin_center.js" ] && [ -f "$MWORK_DIR/mobile.js" ]
    then
        if [ "$direct_job" == "y" ]
        then
            echo "warning!! Work directly on the original file without backup.\n"
        else
            cd $WORK_DIR
            tar -cf $BKUP_DIR/$TIME/admin_center.tar admin_center.js*
            cd $MWORK_DIR
            tar -cf $BKUP_DIR/$TIME/mobile.tar mobile.js*
        fi
        if [ "$MA_VER" -eq "6" ] && [ "$MI_VER" -ge "2" ]
        then
            mv $WORK_DIR/admin_center.js.gz $BKUP_DIR/
            mv $MWORK_DIR/mobile.js.gz $BKUP_DIR/
	        cd $BKUP_DIR/
            gzip -df $BKUP_DIR/admin_center.js.gz 
            gzip -df $BKUP_DIR/mobile.js.gz        
        else
            cp -Rf $WORK_DIR/admin_center.js $BKUP_DIR/
            cp -Rf $MWORK_DIR/mobile.js $BKUP_DIR/
        fi
    else
        COMMENT08_FN
    fi
}

GATHER_FN () {
    DMI_CHK=`dmidecode | grep 'SMBIOS' | egrep 'NO|sorry' | wc -l`
    if [ "$DMI_CHK" -gt "0" ]
    then
        cpu_vendor=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $4}'`
        if [ "$cpu_vendor" == "AMD" ]
        then
            cpu_family=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk -F "$cpu_vendor " '{ print $2 }' | awk -F "Processor" '{ print $1 }'`
            cpu_series=""
        else
            cpu_family=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $5}'`        
            cpu_series=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{ if (index($7,"@")!=0) { print $6 } else { print $6" "$7 } }'`
        fi        
    else
        cpu_vendor=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $2}'`
        if [ "$cpu_vendor" == "AMD" ]
        then
            cpu_family=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk -F "$cpu_vendor " '{ print $2 }' | awk -F "Processor" '{ print $1 }'`
            cpu_series=""
        else
            cpu_family=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $3}'`        
            cpu_series=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{ if (index($5,"@")!=0) { print $4 } else { print $4" "$5 } }'`
        fi
    fi
    cpu_cores=`cat /proc/cpuinfo | grep processor| wc -l`
}

PERFORM_FN () {
    if [ -f "$BKUP_DIR/admin_center.js" ] && [ -f "$BKUP_DIR/mobile.js" ]
    then    
        if [ "$MA_VER" -ge "6" ]
        then
            cpu_info=`echo "f.cpu_vendor=\"${cpu_vendor}\";f.cpu_family=\"${cpu_family}\";f.cpu_series=\"${cpu_series}\";f.cpu_cores=\"${cpu_cores}\";"`
            sed -i "s/f.model]);/f.model]);${cpu_info}/g" $BKUP_DIR/admin_center.js

            cpu_info_m=`echo "{name: \"cpu_series\",renderer: function(value){var cpu_vendor=\"${cpu_vendor}\";var cpu_family=\"${cpu_family}\";var cpu_series=\"${cpu_series}\";var cpu_cores=\"${cpu_cores}\";return Ext.String.format('{0} {1} {2} ({3}Core)', cpu_vendor, cpu_family, cpu_series, cpu_cores);},label: _T(\"status\", \"cpu_model_name\")},"`
            sed -i "s/\"ds_model\")},/\"ds_model\")},${cpu_info_m}/g" $BKUP_DIR/mobile.js
        else
            if [ "$MI_VER" -gt "0" ]
            then
                cpu_info=`echo "b.cpu_vendor=\"${cpu_vendor}\";b.cpu_family=\"${cpu_family}\";b.cpu_series=\"${cpu_series}\";b.cpu_cores=\"${cpu_cores}\";"`
            else
                cpu_info=`echo "b.cpu_vendor=\"${cpu_vendor}\";b.cpu_family=\"${cpu_family} ${cpu_series}\";b.cpu_cores=\"${cpu_cores}\";"`
            fi
            sed -i "s/b.model]);/b.model]);${cpu_info}/g" $BKUP_DIR/admin_center.js
        fi
    else
        COMMENT08_FN
    fi
}

APPLY_FN () {
    if [ -f "$BKUP_DIR/admin_center.js" ] && [ -f "$BKUP_DIR/mobile.js" ]
    then    
        cp -Rf $BKUP_DIR/admin_center.js $WORK_DIR/
        cp -Rf $BKUP_DIR/mobile.js $MWORK_DIR/
        if [ "$MA_VER" -eq "6" ] && [ "$MI_VER" -ge "2" ]
        then    
            gzip -f $BKUP_DIR/admin_center.js
            gzip -f $BKUP_DIR/mobile.js
            mv $BKUP_DIR/admin_center.js.gz $WORK_DIR/
            mv $BKUP_DIR/mobile.js.gz $MWORK_DIR/
        else
            rm -rf $BKUP_DIR/admin_center.js
            rm -rf $BKUP_DIR/mobile.js
        fi
    else
        COMMENT08_FN
    fi        
}

RECOVER_FN () {
    if [ -d "$BKUP_DIR/$TIME" ]
    then
        cd $WORK_DIR
        tar -xf $BKUP_DIR/$TIME/admin_center.tar
        if [ -f "$BKUP_DIR/$TIME/mobile.tar" ]
        then
            cd $MWORK_DIR
            tar -xf $BKUP_DIR/$TIME/mobile.tar
        fi
        if [ "$re_check" == "y" ]
        then
            echo -e "Restore to source and continue.\n"
        else
            COMMENT09_FN
        fi
    else
        COMMENT08_FN
    fi
}

RERUN_FN () {
    if [ "$1" == "redo" ]
    then
        ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | awk '{print "rm -rf '$BKUP_DIR'/"$9}' | sh
        GATHER_FN
        if [ -f "$WORK_DIR/admin_center.js" ] && [ -f "$MWORK_DIR/mobile.js" ]
        then
            info_cnt=`cat $WORK_DIR/admin_center.js | grep ".model]);if(Ext.isDefined" | wc -l`
            info_cnt_m=`cat $MWORK_DIR/mobile.js | grep "ds_model\")},{name:\"ram_size" | wc -l`
            if [ "$info_cnt" -eq "0" ] && [ "$info_cnt_m" -eq "0" ]
            then
                if [ "$MA_VER" -ge "6" ]
                then
                    cpu_info="f.cpu_vendor=\\\"${cpu_vendor}\\\";f.cpu_family=\\\"${cpu_family}\\\";f.cpu_series=\\\"${cpu_series}\\\";f.cpu_cores=\\\"${cpu_cores}\\\";"
                    sed -i "s/${cpu_info}//g" $WORK_DIR/admin_center.js

                    cpu_info_m="{name: \\\"cpu_series\\\",renderer: function(value){var cpu_vendor=\\\"${cpu_vendor}\\\";var cpu_family=\\\"${cpu_family}\\\";var cpu_series=\\\"${cpu_series}\\\";var cpu_cores=\\\"${cpu_cores}\\\";return Ext.String.format('{0} {1} {2} ({3}Core)', cpu_vendor, cpu_family, cpu_series, cpu_cores);},label: _T(\\\"status\\\", \\\"cpu_model_name\\\")},"
                    sed -i "s/${cpu_info_m}//g" $MWORK_DIR/mobile.js                    
                    if [ "$MI_VER" -ge "2" ]
                    then
                        cp -Rf $WORK_DIR/admin_center.js $WORK_DIR/admin_center.js.1
                        cp -Rf $MWORK_DIR/mobile.js $MWORK_DIR/mobile.js.1
                        gzip -f $WORK_DIR/admin_center.js
                        gzip -f $MWORK_DIR/mobile.js
                        mv $WORK_DIR/admin_center.js.1 $WORK_DIR/admin_center.js
                        mv $MWORK_DIR/mobile.js.1 $MWORK_DIR/mobile.js
                    fi
                else
                    if [ "$MI_VER" -gt "0" ]
                    then
                        cpu_info="b.cpu_vendor=\\\"${cpu_vendor}\\\";b.cpu_family=\\\"${cpu_family}\\\";b.cpu_series=\\\"${cpu_series}\\\";b.cpu_cores=\\\"${cpu_cores}\\\";"
                    else
                        cpu_info="b.cpu_vendor=\\\"${cpu_vendor}\\\";b.cpu_family=\\\"${cpu_family} ${cpu_series}\\\";b.cpu_cores=\\\"${cpu_cores}\\\";"
                    fi
                    sed -i "s/${cpu_info}//g" $WORK_DIR/admin_center.js
                fi
            fi
        else
            COMMENT08_FN
        fi    
    fi
}

BLCHECK_FN () {
    bl_check=n
    if [ -d "$BKUP_DIR" ]
    then
        BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | wc -l`
        if [ "$BK_CNT" -gt "0" ]
        then
            BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep "$BL_CHK" | wc -l`
            if [ "$BK_CNT" -gt "0" ]
            then
                TIME=`ls -l $BKUP_DIR/ | grep ^d | grep "$BL_CHK" | awk '{print $9}' | head -1`
                BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | wc -l`
                if [ "$BK_CNT" -gt "0" ]
                then
                    BLSUB_FN "$1"
                else
                    if [ "$re_check" == "n" ]
                    then
                        if [ "$1" == "run" ]
                        then
                            COMMENT03_FN
                        fi
                        COMMENT05_FN
                    else
                        STIME=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1`
                        BLSUB_FN "redo"
                    fi
                fi
            else
                if [ "$1" == "restore" ]
                then
                    COMMENT07_FN
                fi
                BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | wc -l`
                if [ "$BK_CNT" -gt "0" ]
                then
                    BL_COM=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1 | awk -F_ '{print $2}'`
                    BL_CNT=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1 | awk -F_ '{print $2}' | wc -l`
                    if [ "$BL_COM" == "" ]
                    then
                        if [ "$BL_CNT" -gt "0" ]
                        then
                            BLSUB_FN "$1"
                            bl_check=y
                        else
                            COMMENT06_FN
                        fi
                    else
                        TIME=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1`
                        if [ "$BL_CHK" == "$BL_COM" ]
                        then
                            if [ "$1" == "run" ]
                            then
                                COMMENT03_FN
                            else
                                COMMENT05_FN
                                bl_check=n
                            fi
                        else
                            if [ "$BL_CHK" -gt "$BL_COM" ]
                            then
                                BLSUB_FN "$1"
                                bl_check=y
                            else
                                COMMENT06_FN
                            fi
                        fi
                    fi
                else
                    COMMENT06_FN
                fi
            fi
        else
            CASE_FN "$1"
        fi
    else
        CASE_FN "$1"
    fi
}

BLSUB_FN () {
    TIME=`echo "$STIME"`
    if [ "$1" == "run" ]
    then
        RERUN_FN "redo"
    else
        RERUN_FN "$1"
    fi
    COMMENT05_FN
}

CASE_FN () {
    case "$1" in
        run) COMMENT05_FN ;;
        redo) COMMENT07_FN ;;        
        restore) COMMENT07_FN ;;
        *) COMMENT06_FN ;;
    esac    
}

EXEC_FN () {
if [ -d $WORK_DIR ]
then    
    READ_YN "Auto Excute, If you select n, proceed interactively  (Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]
    then
        mkdir -p $BKUP_DIR/$TIME

        if [ "$re_check" == "y" ]
        then
            if [ "$bl_check" == "y" ]
            then
 		        COMMENT04_FN
            else
                RECOVER_FN
            fi
        fi

        PREPARE_FN

        GATHER_FN

        PERFORM_FN

        APPLY_FN

        COMMENT09_FN

    elif [ "$Y_N" == "n" ]
    then
        READ_YN "Proceed with original file backup and preparation.. If you select n, Work directly on the original file. (Cancel : q) [y/n] : "
        if [ "$Y_N" == "y" ]    
        then
            mkdir -p $BKUP_DIR/$TIME

            if [ "$re_check" == "y" ]
            then
                if [ "$bl_check" == "y" ]
                then
 		            COMMENT04_FN
                else
                    RECOVER_FN
                fi
            fi

            PREPARE_FN

        elif [ "$Y_N" == "n" ]
        then
            direct_job=y
            mkdir -p $BKUP_DIR
            PREPARE_FN            
        else
            COMMENT10_FN
        fi

        READ_YN "CPU name, Core count and reflects it. If you select n, Resote original file (Cancel : q) [y/n] : "
        if [ "$Y_N" == "y" ]    
        then    
            GATHER_FN

            PERFORM_FN

            APPLY_FN

		    COMMENT09_FN
        elif [ "$Y_N" == "n" ]
        then
	        if [ -d "$BKUP_DIR" ]
    	    then
                gzip $BKUP_DIR/admin_center.js
                gzip $BKUP_DIR/mobile.js
                mv $BKUP_DIR/admin_center.js.gz $WORK_DIR/
                mv $BKUP_DIR/mobile.js.gz $MWORK_DIR/
                COMMENT09_FN
		    else
			    COMMENT07_FN
		    fi
        else
            COMMENT10_FN
        fi
    else
        COMMENT10_FN
    fi
else
    COMMENT08_FN
fi
}

COMMENT03_FN () {
    echo -e "There is a history of running the same version. Please run again select 2) redo .\n"
    exit 0
}

COMMENT04_FN () {
    echo -e "Do not restore to source when installing a higher version. Contiue...\n"
}

COMMENT05_FN () {
    echo -e "You have verified and installed the previous version. Contiue...\n"
}

COMMENT06_FN () {
    echo -e "Problem and exit. Please run again after checking."
    exit 0    
}

COMMENT07_FN () {
    echo -e "No execution history. Please go back to the first run."
    exit 0
}

COMMENT08_FN () {
    echo -e "The target file(location) does not exist. Please run again after checking."
    exit 0
}

COMMENT09_FN () {
    echo -e "The operation is complete!! It takes about 1-2 minutes to reflect, \n(Please refresh the DSM page with F5 or after logout/login and check the information.)"
    exit 0
}

COMMENT10_FN () {
    echo -e "Only y / n / q can be input. Please proceed again."
    exit 0
}

# ==============================================================================
# Main Progress
# ==============================================================================
clear
WORK_DIR="/usr/syno/synoman/webman/modules/AdminCenter"
MWORK_DIR="/usr/syno/synoman/mobile/ui"
BKUP_DIR="/root/Xpenology_backup"
VER_DIR="/etc.default"

echo "DSM CPU Information Change Tool ver. \033[0;31m"$ver"\033[00m - made by FOXBI\n"

if [ -d "$VER_DIR" ]
then
    VER_FIL="$VER_DIR/VERSION"
else
    VER_FIL="/etc/VERSION"
fi

if [ -f "$VER_FIL" ]
then
    MA_VER=`cat $VER_FIL | grep majorversion | awk -F \= '{print $2}' | sed 's/\"//g'`
    MI_VER=`cat $VER_FIL | grep minorversion | awk -F \= '{print $2}' | sed 's/\"//g'`
    BL_NUM=`cat $VER_FIL | grep buildnumber | awk -F \= '{print $2}' | sed 's/\"//g'`    
    BL_FIX=`cat $VER_FIL | grep smallfixnumber | awk -F \= '{print $2}' | sed 's/\"//g'`
else
    COMMENT08_FN
fi

BL_CHK=$BL_NUM$BL_FIX
TIME=`date +%Y%m%d%H%M%S`"_"$BL_CHK
STIME=`echo "$TIME"`

if [ "$MA_VER" -gt "4" ]
then
    if [ "$MA_VER" -eq "5" ]
    then
        MWORK_DIR="/usr/syno/synoman/webman/mapp"
    fi
    echo "Your version of DSM is \033[0;36mDSM \033[0;31m"$MA_VER"."$MI_VER"\033[0;32m continue...\n"
else
    echo "DSM version less than 5 is not supported. End the process."
    exit 0
fi

read -n1 -p "1) First run  2) Redo  3) Restore - Select Number : " inst_z 
   case "$inst_z" in
   1) inst_check=run 
      echo -e "\n " ;;
   2) inst_check=redo 
      echo -e "\n " ;;
   3) inst_check=restore 
      echo -e "\n " ;;
   *) echo -e "\n" ;;
   esac

if [ "$inst_check" == "redo" ]
then
	READ_YN "Do you want to proceed again? Restore to original file backup and proceed.(Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]    
    then
        re_check=y        
        BLCHECK_FN "$inst_check"
        inst_check=run
        EXEC_FN
    elif [ "$Y_N" == "n" ]
    then
        echo "Do not proceed with the redo."    
    else
        COMMENT10_FN
    fi
elif [ "$inst_check" == "restore" ]
then
	READ_YN "Do you want to restore using the original backup file? (Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]    
    then
        re_check=n
        BLCHECK_FN "$inst_check"
        RECOVER_FN
    elif [ "$Y_N" == "n" ]
    then
        echo "No restore was performed."   
    else
        COMMENT10_FN
    fi
elif [ "$inst_check" == "run" ]
then
    re_check=n
    BLCHECK_FN "$inst_check"
    EXEC_FN
else
    echo "Please select the correct number."
fi

 

 

You have nothing to be embarrassed about, FOXBI!  Your code is much more elegant than some of my bash scripts 😉

감사합니다 !!

 

Unfortunately, it still doesn't quite work for me - it recognizes my Core i3-6100T (specs) correctly, but it says I have 4 CPU cores:

UBUq6sQ.png

when in fact there are only 2.  I am not sure why it thinks so, the commands get it right:

 

# dmidecode -t processor

# dmidecode 2.12
SMBIOS 3.0 present.
# SMBIOS implementations newer than version 2.7 are not
# fully supported by this version of dmidecode.

Handle 0x000C, DMI type 4, 48 bytes
Processor Information
        Socket Designation: CPUSocket
        Type: Central Processor
        Family: Core i3
        Manufacturer: Intel(R) Corporation
        ID: E3 06 05 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 94, Stepping 3
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (FXSAVE and FXSTOR instructions supported)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Multi-threading)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Core(TM) i3-6100T CPU @ 3.20GHz
        Voltage: 1.1 V
        External Clock: 100 MHz
        Max Speed: 3200 MHz
        Current Speed: 3200 MHz
        Status: Populated, Enabled
        Upgrade: Other
        L1 Cache Handle: 0x0009
        L2 Cache Handle: 0x000A
        L3 Cache Handle: 0x000B
        Serial Number: To Be Filled By O.E.M.
        Asset Tag: To Be Filled By O.E.M.
        Part Number: To Be Filled By O.E.M.
        Core Count: 2
        Core Enabled: 2
        Thread Count: 4
        Characteristics:
                64-bit capable
                Multi-Core
                Hardware Thread
                Execute Protection
                Enhanced Virtualization
                Power/Performance Control
# cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 94
model name      : Intel(R) Core(TM) i3-6100T CPU @ 3.20GHz
stepping        : 3
microcode       : 0xc2
cpu MHz         : 3101.000
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat epb xsaveopt pln pts invpcid_single spec_ctrl ibpb_support tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap
bogomips        : 6384.58
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

Maybe your code is confusing number of threads with number of cores?

 

Thanks again 😊

  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/26/2018 at 8:33 PM, Vileserver said:

Maybe your code is confusing number of threads with number of cores?

 

Thanks again 😊

 

That's exactly what I was trying to share in my earlier post, if just based on the numbers alone....don't know if it's displaying based on Hyper-Threading capable.  🤔

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, gericb said:

 

That's exactly what I was trying to share in my earlier post, if just based on the numbers alone....don't know if it's displaying based on Hyper-Threading capable.  🤔

 

Before I ran FOXBI's script, the specs said 4 cores for Xeon D-1527, which is the CPU in the DS3617xs:

2NHDJUa.png

 

Note this is the number of cores, NOT threads which would be 8 for this CPU!  Check Intel's datasheet here.

So DSM is always meant to show physical cores, not logical ones.  Therefore this is a small bug in the script....

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

OK, here is a slightly updated version, I call it 4.01.

Fixes:

  • improve CPU core determination
  • fix color output
  • fix typos

Thanks again to FOXBI for this great script!  I hope you don't mind me making some small changes to it.

 

gericb, does this work for you?

 

 

Spoiler

#!/bin/bash
# ver 4.01 2018.10.28 Made by Vileserver (fix CPU core determination)
# ver 4.0  2018.09.13 Made by FOXBI
# ver 3.0  2018.08.24 Made by FOXBI
# Ver 1.5  2018.08.23 Made by FOXBI
# Ver 1.1  2018.08.22 Made by FOXBI
# Ver 1.0  2018.08.17 Made by FOXBI
ver="4.01"
# ==============================================================================
# Y or N Function
# ==============================================================================
READ_YN () { # $1:question $2:default
   read -n1 -p "$1" Y_N
    case "$Y_N" in
    y) Y_N="y"
         echo -e "\n" ;;
    n) Y_N="n"
         echo -e "\n" ;;        
    q) echo -e "\n"
       exit 0 ;;
    *) echo -e "\n" ;;
    esac
}

# ==============================================================================
# Process Function
# ==============================================================================
PREPARE_FN () {
    if [ -f "$WORK_DIR/admin_center.js" ] && [ -f "$MWORK_DIR/mobile.js" ]
    then
        if [ "$direct_job" == "y" ]
        then
            echo "warning!! Work directly on the original file without backup.\n"
        else
            cd $WORK_DIR
            tar -cf $BKUP_DIR/$TIME/admin_center.tar admin_center.js*
            cd $MWORK_DIR
            tar -cf $BKUP_DIR/$TIME/mobile.tar mobile.js*
        fi
        if [ "$MA_VER" -eq "6" ] && [ "$MI_VER" -ge "2" ]
        then
            mv $WORK_DIR/admin_center.js.gz $BKUP_DIR/
            mv $MWORK_DIR/mobile.js.gz $BKUP_DIR/
            cd $BKUP_DIR/
            gzip -df $BKUP_DIR/admin_center.js.gz
            gzip -df $BKUP_DIR/mobile.js.gz        
        else
            cp -Rf $WORK_DIR/admin_center.js $BKUP_DIR/
            cp -Rf $MWORK_DIR/mobile.js $BKUP_DIR/
        fi
    else
        COMMENT08_FN
    fi
}

GATHER_FN () {
    DMI_CHK=`dmidecode | grep 'SMBIOS' | egrep 'NO|sorry' | wc -l`
    if [ "$DMI_CHK" -gt "0" ]
    then
        cpu_vendor=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $4}'`
        if [ "$cpu_vendor" == "AMD" ]
        then
            cpu_family=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk -F "$cpu_vendor " '{ print $2 }' | awk -F "Processor" '{ print $1 }'`
            cpu_series=""
        else
            cpu_family=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $5}'`        
            cpu_series=`cat /proc/cpuinfo | grep model | grep name | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{ if (index($7,"@")!=0) { print $6 } else { print $6" "$7 } }'`
        fi        
    else
        cpu_vendor=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $2}'`
        if [ "$cpu_vendor" == "AMD" ]
        then
            cpu_family=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk -F "$cpu_vendor " '{ print $2 }' | awk -F "Processor" '{ print $1 }'`
            cpu_series=""
        else
            cpu_family=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{print $3}'`        
            cpu_series=`dmidecode -t processor | grep Version | grep -v Unknown | grep -v Not | sort -u | sed "s/(.)//g" | sed "s/(..)//g" | sed "s/CPU//g" | awk '{ if (index($5,"@")!=0) { print $4 } else { print $4" "$5 } }'`
        fi
    fi
    cpu_cores=`grep '^cpu cores' /proc/cpuinfo | uniq | awk '{print $4}'`
}

PERFORM_FN () {
    if [ -f "$BKUP_DIR/admin_center.js" ] && [ -f "$BKUP_DIR/mobile.js" ]
    then    
        if [ "$MA_VER" -ge "6" ]
        then
            cpu_info=`echo "f.cpu_vendor=\"${cpu_vendor}\";f.cpu_family=\"${cpu_family}\";f.cpu_series=\"${cpu_series}\";f.cpu_cores=\"${cpu_cores}\";"`
            sed -i "s/f.model]);/f.model]);${cpu_info}/g" $BKUP_DIR/admin_center.js

            cpu_info_m=`echo "{name: \"cpu_series\",renderer: function(value){var cpu_vendor=\"${cpu_vendor}\";var cpu_family=\"${cpu_family}\";var cpu_series=\"${cpu_series}\";var cpu_cores=\"${cpu_cores}\";return Ext.String.format('{0} {1} {2} ({3}Core)', cpu_vendor, cpu_family, cpu_series, cpu_cores);},label: _T(\"status\", \"cpu_model_name\")},"`
            sed -i "s/\"ds_model\")},/\"ds_model\")},${cpu_info_m}/g" $BKUP_DIR/mobile.js
        else
            if [ "$MI_VER" -gt "0" ]
            then
                cpu_info=`echo "b.cpu_vendor=\"${cpu_vendor}\";b.cpu_family=\"${cpu_family}\";b.cpu_series=\"${cpu_series}\";b.cpu_cores=\"${cpu_cores}\";"`
            else
                cpu_info=`echo "b.cpu_vendor=\"${cpu_vendor}\";b.cpu_family=\"${cpu_family} ${cpu_series}\";b.cpu_cores=\"${cpu_cores}\";"`
            fi
            sed -i "s/b.model]);/b.model]);${cpu_info}/g" $BKUP_DIR/admin_center.js
        fi
    else
        COMMENT08_FN
    fi
}

APPLY_FN () {
    if [ -f "$BKUP_DIR/admin_center.js" ] && [ -f "$BKUP_DIR/mobile.js" ]
    then    
        cp -Rf $BKUP_DIR/admin_center.js $WORK_DIR/
        cp -Rf $BKUP_DIR/mobile.js $MWORK_DIR/
        if [ "$MA_VER" -eq "6" ] && [ "$MI_VER" -ge "2" ]
        then    
            gzip -f $BKUP_DIR/admin_center.js
            gzip -f $BKUP_DIR/mobile.js
            mv $BKUP_DIR/admin_center.js.gz $WORK_DIR/
            mv $BKUP_DIR/mobile.js.gz $MWORK_DIR/
        else
            rm -rf $BKUP_DIR/admin_center.js
            rm -rf $BKUP_DIR/mobile.js
        fi
    else
        COMMENT08_FN
    fi        
}

RECOVER_FN () {
    if [ -d "$BKUP_DIR/$TIME" ]
    then
        cd $WORK_DIR
        tar -xf $BKUP_DIR/$TIME/admin_center.tar
        if [ -f "$BKUP_DIR/$TIME/mobile.tar" ]
        then
            cd $MWORK_DIR
            tar -xf $BKUP_DIR/$TIME/mobile.tar
        fi
        if [ "$re_check" == "y" ]
        then
            echo -e "Restore to source and continue.\n"
        else
            COMMENT09_FN
        fi
    else
        COMMENT08_FN
    fi
}

RERUN_FN () {
    if [ "$1" == "redo" ]
    then
        ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | awk '{print "rm -rf '$BKUP_DIR'/"$9}' | sh
        GATHER_FN
        if [ -f "$WORK_DIR/admin_center.js" ] && [ -f "$MWORK_DIR/mobile.js" ]
        then
            info_cnt=`cat $WORK_DIR/admin_center.js | grep ".model]);if(Ext.isDefined" | wc -l`
            info_cnt_m=`cat $MWORK_DIR/mobile.js | grep "ds_model\")},{name:\"ram_size" | wc -l`
            if [ "$info_cnt" -eq "0" ] && [ "$info_cnt_m" -eq "0" ]
            then
                if [ "$MA_VER" -ge "6" ]
                then
                    cpu_info="f.cpu_vendor=\\\"${cpu_vendor}\\\";f.cpu_family=\\\"${cpu_family}\\\";f.cpu_series=\\\"${cpu_series}\\\";f.cpu_cores=\\\"${cpu_cores}\\\";"
                    sed -i "s/${cpu_info}//g" $WORK_DIR/admin_center.js

                    cpu_info_m="{name: \\\"cpu_series\\\",renderer: function(value){var cpu_vendor=\\\"${cpu_vendor}\\\";var cpu_family=\\\"${cpu_family}\\\";var cpu_series=\\\"${cpu_series}\\\";var cpu_cores=\\\"${cpu_cores}\\\";return Ext.String.format('{0} {1} {2} ({3}Core)', cpu_vendor, cpu_family, cpu_series, cpu_cores);},label: _T(\\\"status\\\", \\\"cpu_model_name\\\")},"
                    sed -i "s/${cpu_info_m}//g" $MWORK_DIR/mobile.js                    
                    if [ "$MI_VER" -ge "2" ]
                    then
                        cp -Rf $WORK_DIR/admin_center.js $WORK_DIR/admin_center.js.1
                        cp -Rf $MWORK_DIR/mobile.js $MWORK_DIR/mobile.js.1
                        gzip -f $WORK_DIR/admin_center.js
                        gzip -f $MWORK_DIR/mobile.js
                        mv $WORK_DIR/admin_center.js.1 $WORK_DIR/admin_center.js
                        mv $MWORK_DIR/mobile.js.1 $MWORK_DIR/mobile.js
                    fi
                else
                    if [ "$MI_VER" -gt "0" ]
                    then
                        cpu_info="b.cpu_vendor=\\\"${cpu_vendor}\\\";b.cpu_family=\\\"${cpu_family}\\\";b.cpu_series=\\\"${cpu_series}\\\";b.cpu_cores=\\\"${cpu_cores}\\\";"
                    else
                        cpu_info="b.cpu_vendor=\\\"${cpu_vendor}\\\";b.cpu_family=\\\"${cpu_family} ${cpu_series}\\\";b.cpu_cores=\\\"${cpu_cores}\\\";"
                    fi
                    sed -i "s/${cpu_info}//g" $WORK_DIR/admin_center.js
                fi
            fi
        else
            COMMENT08_FN
        fi    
    fi
}

BLCHECK_FN () {
    bl_check=n
    if [ -d "$BKUP_DIR" ]
    then
        BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | wc -l`
        if [ "$BK_CNT" -gt "0" ]
        then
            BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep "$BL_CHK" | wc -l`
            if [ "$BK_CNT" -gt "0" ]
            then
                TIME=`ls -l $BKUP_DIR/ | grep ^d | grep "$BL_CHK" | awk '{print $9}' | head -1`
                BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | wc -l`
                if [ "$BK_CNT" -gt "0" ]
                then
                    BLSUB_FN "$1"
                else
                    if [ "$re_check" == "n" ]
                    then
                        if [ "$1" == "run" ]
                        then
                            COMMENT03_FN
                        fi
                        COMMENT05_FN
                    else
                        STIME=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1`
                        BLSUB_FN "redo"
                    fi
                fi
            else
                if [ "$1" == "restore" ]
                then
                    COMMENT07_FN
                fi
                BK_CNT=`ls -l $BKUP_DIR/ | grep ^d | grep -v "$BL_CHK" | wc -l`
                if [ "$BK_CNT" -gt "0" ]
                then
                    BL_COM=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1 | awk -F_ '{print $2}'`
                    BL_CNT=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1 | awk -F_ '{print $2}' | wc -l`
                    if [ "$BL_COM" == "" ]
                    then
                        if [ "$BL_CNT" -gt "0" ]
                        then
                            BLSUB_FN "$1"
                            bl_check=y
                        else
                            COMMENT06_FN
                        fi
                    else
                        TIME=`ls -l $BKUP_DIR/ | grep ^d | awk '{print $9}' | head -1`
                        if [ "$BL_CHK" == "$BL_COM" ]
                        then
                            if [ "$1" == "run" ]
                            then
                                COMMENT03_FN
                            else
                                COMMENT05_FN
                                bl_check=n
                            fi
                        else
                            if [ "$BL_CHK" -gt "$BL_COM" ]
                            then
                                BLSUB_FN "$1"
                                bl_check=y
                            else
                                COMMENT06_FN
                            fi
                        fi
                    fi
                else
                    COMMENT06_FN
                fi
            fi
        else
            CASE_FN "$1"
        fi
    else
        CASE_FN "$1"
    fi
}

BLSUB_FN () {
    TIME=`echo "$STIME"`
    if [ "$1" == "run" ]
    then
        RERUN_FN "redo"
    else
        RERUN_FN "$1"
    fi
    COMMENT05_FN
}

CASE_FN () {
    case "$1" in
        run) COMMENT05_FN ;;
        redo) COMMENT07_FN ;;        
        restore) COMMENT07_FN ;;
        *) COMMENT06_FN ;;
    esac    
}

EXEC_FN () {
if [ -d $WORK_DIR ]
then    
    READ_YN "Auto Execute, If you select n, proceed interactively  (Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]
    then
        mkdir -p $BKUP_DIR/$TIME

        if [ "$re_check" == "y" ]
        then
            if [ "$bl_check" == "y" ]
            then
                 COMMENT04_FN
            else
                RECOVER_FN
            fi
        fi

        PREPARE_FN

        GATHER_FN

        PERFORM_FN

        APPLY_FN

        COMMENT09_FN

    elif [ "$Y_N" == "n" ]
    then
        READ_YN "Proceed with original file backup and preparation.. If you select n, Work directly on the original file. (Cancel : q) [y/n] : "
        if [ "$Y_N" == "y" ]    
        then
            mkdir -p $BKUP_DIR/$TIME

            if [ "$re_check" == "y" ]
            then
                if [ "$bl_check" == "y" ]
                then
                     COMMENT04_FN
                else
                    RECOVER_FN
                fi
            fi

            PREPARE_FN

        elif [ "$Y_N" == "n" ]
        then
            direct_job=y
            mkdir -p $BKUP_DIR
            PREPARE_FN            
        else
            COMMENT10_FN
        fi

        READ_YN "CPU name, Core count and reflects it. If you select n, Restore original file (Cancel : q) [y/n] : "
        if [ "$Y_N" == "y" ]    
        then    
            GATHER_FN

            PERFORM_FN

            APPLY_FN

            COMMENT09_FN
        elif [ "$Y_N" == "n" ]
        then
            if [ -d "$BKUP_DIR" ]
            then
                gzip $BKUP_DIR/admin_center.js
                gzip $BKUP_DIR/mobile.js
                mv $BKUP_DIR/admin_center.js.gz $WORK_DIR/
                mv $BKUP_DIR/mobile.js.gz $MWORK_DIR/
                COMMENT09_FN
            else
                COMMENT07_FN
            fi
        else
            COMMENT10_FN
        fi
    else
        COMMENT10_FN
    fi
else
    COMMENT08_FN
fi
}

COMMENT03_FN () {
    echo -e "There is a history of running the same version. Please run again select 2) redo .\n"
    exit 0
}

COMMENT04_FN () {
    echo -e "Do not restore to source when installing a higher version. Continue...\n"
}

COMMENT05_FN () {
    echo -e "You have verified and installed the previous version. Continue...\n"
}

COMMENT06_FN () {
    echo -e "Problem and exit. Please run again after checking."
    exit 0    
}

COMMENT07_FN () {
    echo -e "No execution history. Please go back to the first run."
    exit 0
}

COMMENT08_FN () {
    echo -e "The target file(location) does not exist. Please run again after checking."
    exit 0
}

COMMENT09_FN () {
    echo -e "The operation is complete!! It takes about 1-2 minutes to reflect, \n(Please refresh the DSM page with F5 or after logout/login and check the information.)"
    exit 0
}

COMMENT10_FN () {
    echo -e "Only y / n / q can be input. Please proceed again."
    exit 0
}

# ==============================================================================
# Main Progress
# ==============================================================================
clear
WORK_DIR="/usr/syno/synoman/webman/modules/AdminCenter"
MWORK_DIR="/usr/syno/synoman/mobile/ui"
BKUP_DIR="/root/Xpenology_backup"
VER_DIR="/etc.default"

echo -e "DSM CPU Information Change Tool ver. \033[0;31m"$ver"\033[00m - made by FOXBI\n"

if [ -d "$VER_DIR" ]
then
    VER_FIL="$VER_DIR/VERSION"
else
    VER_FIL="/etc/VERSION"
fi

if [ -f "$VER_FIL" ]
then
    MA_VER=`cat $VER_FIL | grep majorversion | awk -F \= '{print $2}' | sed 's/\"//g'`
    MI_VER=`cat $VER_FIL | grep minorversion | awk -F \= '{print $2}' | sed 's/\"//g'`
    BL_NUM=`cat $VER_FIL | grep buildnumber | awk -F \= '{print $2}' | sed 's/\"//g'`    
    BL_FIX=`cat $VER_FIL | grep smallfixnumber | awk -F \= '{print $2}' | sed 's/\"//g'`
else
    COMMENT08_FN
fi

BL_CHK=$BL_NUM$BL_FIX
TIME=`date +%Y%m%d%H%M%S`"_"$BL_CHK
STIME=`echo "$TIME"`

if [ "$MA_VER" -gt "4" ]
then
    if [ "$MA_VER" -eq "5" ]
    then
        MWORK_DIR="/usr/syno/synoman/webman/mapp"
    fi
    echo -e "Your version of DSM is \033[0;36mDSM \033[0;31m"$MA_VER"."$MI_VER"\033[0;32m continue...\033[00m\n"
else
    echo "DSM version less than 5 is not supported. End the process."
    exit 0
fi

read -n1 -p "1) First run  2) Redo  3) Restore - Select Number : " inst_z
   case "$inst_z" in
   1) inst_check=run
      echo -e "\n " ;;
   2) inst_check=redo
      echo -e "\n " ;;
   3) inst_check=restore
      echo -e "\n " ;;
   *) echo -e "\n" ;;
   esac

if [ "$inst_check" == "redo" ]
then
    READ_YN "Do you want to proceed again? Restore to original file backup and proceed.(Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]    
    then
        re_check=y        
        BLCHECK_FN "$inst_check"
        inst_check=run
        EXEC_FN
    elif [ "$Y_N" == "n" ]
    then
        echo "Do not proceed with the redo."    
    else
        COMMENT10_FN
    fi
elif [ "$inst_check" == "restore" ]
then
    READ_YN "Do you want to restore using the original backup file? (Cancel : q) [y/n] : "
    if [ "$Y_N" == "y" ]    
    then
        re_check=n
        BLCHECK_FN "$inst_check"
        RECOVER_FN
    elif [ "$Y_N" == "n" ]
    then
        echo "No restore was performed."   
    else
        COMMENT10_FN
    fi
elif [ "$inst_check" == "run" ]
then
    re_check=n
    BLCHECK_FN "$inst_check"
    EXEC_FN
else
    echo "Please select the correct number."
fi

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 10/25/2018 at 9:47 PM, Olegin said:

@FOXBI It seems, that don't work on 6.2.1 with 1.04b loader.

 

UPD: After reboot - ok.

 

Sorry, I have not yet prepared the 1.04b environment.

 

I'll check it later when I'm ready. :)

 

Share this post


Link to post
Share on other sites
11 hours ago, Vileserver said:

OK, here is a slightly updated version, I call it 4.01.

Fixes:

  • improve CPU core determination
  • fix color output
  • fix typos

Thanks again to FOXBI for this great script!  I hope you don't mind me making some small changes to it.

 

gericb, does this work for you?

 

 

Sorry. Unfortunately, you modified it to 4.01, and I also updated the 5.0 new version.

 

 

In addition, i'll check the fix part and reflect it later.

Share this post


Link to post
Share on other sites
On 8/17/2018 at 11:41 PM, FOXBI said:

ch_cpuinfo ver 5.0 - update new version

-> ch_cpuinfo_en.tar

-> ch_cpuinfo_ko.tar

 

I uploaded a new version file that change to core information collection method. It's possible to use !! :)

 

 

I made a mistaken judgment by my business habits.

 

I apologize for the wrong information.

Edited by FOXBI
some edited comment

Share this post


Link to post
Share on other sites
9 hours ago, FOXBI said:

 

I uploaded a new version file that change to core information collection method. It's possible to use !! :)

 

Fantastic!  Thanks FOXBI.

Any chance you can also post the shell script?  I think most users here prefer the bash source.

 

Thanks 😊

  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, Vileserver said:

Fantastic!  Thanks FOXBI.

Any chance you can also post the shell script?  I think most users here prefer the bash source.

 

Sorry, I'm afraid I have to show you next time.

 

The code in this section is not complicated, but the current source for the CPU core is the code I made for use in my work area.

 

It is likely to be misunderstood as business data leakage by me.

 

so, I think possible to disclose after changing some variables and contents.

 

I would be grateful if you could wait a little longer.

 

 

Add to..

 

It's actually in the main topic. 

 

It is not a difficult part because it is produced through the values collected by the following five variables.

cat /proc/cpuinfo | grep "processor" | sort -u | wc -l
cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l
cat /proc/cpuinfo | grep "core id" | sort -u | wc -l
cat /proc/cpuinfo | grep "siblings" | sort -u | awk '{print $NF}'
cat /proc/cpuinfo | grep "cpu cores" | sort -u | awk '{print $NF}'

 

  • Thanks 1

Share this post


Link to post
Share on other sites
6 hours ago, FOXBI said:

 

It is not a difficult part because it is produced through the values collected by the following five variables.


cat /proc/cpuinfo | grep "processor" | sort -u | wc -l
cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l
cat /proc/cpuinfo | grep "core id" | sort -u | wc -l
cat /proc/cpuinfo | grep "siblings" | sort -u | awk '{print $NF}'
cat /proc/cpuinfo | grep "cpu cores" | sort -u | awk '{print $NF}'

 

 

You can actually get the number of CPU cores in just one line, like this:

grep '^cpu cores' /proc/cpuinfo | uniq | awk '{print $4}'

This works for CPUs that have hyper-threading.

 

There are some more interesting methods discussed here: http://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line

 

  • Thanks 1

Share this post


Link to post
Share on other sites
20 minutes ago, Vileserver said:

You can actually get the number of CPU cores in just one line, like this:


grep '^cpu cores' /proc/cpuinfo | uniq | awk '{print $4}'

This works for CPUs that have hyper-threading.

 

There are some more interesting methods discussed here: http://stackoverflow.com/questions/6481005/how-to-obtain-the-number-of-cpus-cores-in-linux-from-the-command-line

 

Thanks for the advice.

 

But, The result value of your code is same to one of my codes below.

cat /proc/cpuinfo | grep "cpu cores" | sort -u | awk '{print $NF}'

If I was just extracting core values, I would have used only one line.

 

The remaining values are collected to make the most of the number of cpu, HT support, vm, intel, amd, openstack, and docker environments.(It may not be perfect.:7_sweat_smile:)

 

I will reference to your link. Thank you very much!!

  • Like 1

Share this post


Link to post
Share on other sites
On 10/30/2018 at 1:18 AM, FOXBI said:

 

I uploaded a new version file that change to core information collection method. It's possible to use !! :)

 

 

I made a mistaken judgment by my business habits.

 

I apologize for the wrong information.

 

SUCCESS! Correct # of cores being displayed, and I appreciate the extra CPU stats presented from the v5.0

  • Thanks 1

Share this post


Link to post
Share on other sites

SynoManager third-party program still shows the same as in the original.

Screenshot_2018-11-05-22-14-54-665_com.rafakob.synomanager.png

Edited by LDiamond
edit
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.