#!/bin/bash CPU=`grep "cpu cores" /proc/cpuinfo |head -1|awk '{print $4}'` COMPENSATION=`grep 'mips' /proc/cpuinfo|head -1|awk -F: '{printf("%.2f",$2/5000)}'` cd /home/judge sed -i "s/OJ_RUNNING=1/OJ_RUNNING=$CPU/g" etc/judge.conf sed -i "s/OJ_CPU_COMPENSATION=1.0/OJ_CPU_COMPENSATION=$COMPENSATION/g" etc/judge.conf