-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrc_local_init.sh
More file actions
27 lines (21 loc) · 937 Bytes
/
rc_local_init.sh
File metadata and controls
27 lines (21 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env bash
# init script when the instance starting
ENV_FILE="/tmp/host-env.log"
# init disk script
truncate -s 0 /etc/rc.local
echo "#!/bin/bash" >> /etc/rc.local
echo "" >> /etc/rc.local
echo "touch /var/lock/subsys/local" >> /etc/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
echo "" >> /etc/rc.local
df -h | grep /mnt/disk | while read v_df
do
v_disk=$(echo ${v_df} | awk '{print $1}')
v_dir=$(echo ${v_df} | awk '{print $6}')
echo "umount ${v_disk} >> ${ENV_FILE} 2>&1" >> /etc/rc.local
echo "tune2fs -o journal_data_writeback ${v_disk} >> ${ENV_FILE} 2>&1" >> /etc/rc.local
echo "tune2fs -O ^has_journal ${v_disk} >> ${ENV_FILE} 2>&1" >> /etc/rc.local
echo "mount -o noatime ${v_disk} ${v_dir} >> ${ENV_FILE} 2>&1" >> /etc/rc.local
echo "" >> /etc/rc.local
done