run chef-client every 30min, make partition script more robust and more intelligent

Change-Id: Ic2f8a3d769a55653dff4824cd7abd1b1c92c8676
This commit is contained in:
xiaodongwang 2014-01-24 22:28:14 -08:00
parent 6e83bd1f51
commit 35e924912a
3 changed files with 28 additions and 25 deletions

View File

@ -57,11 +57,11 @@ echo "path: \$PATH" 2>&1 >> /tmp/ntp.log
echo "new date is: \`date\`" 2>&1 >> /tmp/ntp.log
#end if
chmod +x /etc/chef/rerun.sh
/etc/chef/rerun.sh
chmod +x /etc/chef/rerun.sh
crontab -l > mycron
echo "*/1 * * * * /etc/chef/rerun.sh" >> mycron
echo "*/30 * * * * /etc/chef/rerun.sh" >> mycron
crontab mycron
rm mycron
chkconfig chef off

View File

@ -58,5 +58,3 @@ keys /etc/ntp/keys
# Enable writing of statistics records.
# statistics clockstats cryptostats loopstats peerstats
# make ntpdate using the server in conf to update the system time.
NTPDATE_USE_NTP_CONF=yes

View File

@ -10,18 +10,36 @@
set \$(list-harddrives)
let disk_nums=\$#/2
let disk_offset=0
let found_disk_offset=0
while [ \$disk_offset -lt \$disk_nums ];
do
disks[disk_offset]=\$1
#if $getVar('partitions_only','') != ""
let found_disk=0
#for $partition_only in $partitions_only.split(',')
if [[ "\$1" =~ "$partition_only" ]]; then
disks[found_disk_offset]=\$1
let found_disk=1
fi
#end for
if [ \$found_disk -gt 0 ]; then
let found_disk_offset=\$found_disk_offset+1
fi
#else
disks[found_disk_offset]=\$1
let found_disk_offset=\$found_disk_offset+1
#end if
let disk_offset=\$disk_offset+1
shift 2
done
let disk_nums=\$found_disk_offset
echo "" > /tmp/part-include
#if $getVar('partitions_only','') != ""
echo "clearpart --all --initlabel" > /tmp/part-include
#if $getVar('keep_old_partitions', '0') != "0"
#if $getVar('partitions_only','') != ""
echo "ignoredisk --only-use=$partitions_only" >> /tmp/part-include
#end if
#end if
echo "clearpart --all --initlabel" >> /tmp/part-include
echo "part /boot --fstype ext3 --size=100 --ondisk=\${disks[0]} --asprimary" >> /tmp/part-include
echo "part swap --recommended --ondisk=\${disks[0]}" >> /tmp/part-include
@ -30,23 +48,10 @@ vggroup=''
let disk_offset=0
while [ \$disk_offset -lt \$disk_nums ];
do
let found_partition=0
#if $getVar('partitions_only','') != ""
#for $partition_only in $partitions_only.split(',')
if [[ "\${disks[\$disk_offset]}" =~ "$partition_only" ]]; then
let found_partition=1
fi
#end for
#else
let found_partition=1
#end if
if [ \$found_partition -gt 0 ]; then
let pv_id=\$disk_offset+1
partname="pv.0\$pv_id"
echo "part \$partname --size=1 --grow --ondisk=\${disks[\$disk_offset]}" >> /tmp/part-include
vggroup="\$vggroup \$partname"
fi
let pv_id=\$disk_offset+1
partname="pv.0\$pv_id"
echo "part \$partname --size=1 --grow --ondisk=\${disks[\$disk_offset]}" >> /tmp/part-include
vggroup="\$vggroup \$partname"
let disk_offset=\$disk_offset+1;
done