|
1 | 1 | #!/usr/bin/env bash
|
2 | 2 | set -e
|
3 | 3 |
|
| 4 | +# check time zone is Asia/Shanghai or not, if not, set it to Asia/Shanghai |
| 5 | +#if [ "$(timedatectl | grep "Time zone" | awk '{print $3}')" != "Asia/Shanghai" ]; then |
| 6 | +# echo "Setting time zone to Asia/Shanghai..." |
| 7 | +# sudo timedatectl set-timezone Asia/Shanghai |
| 8 | +#fi |
| 9 | + |
4 | 10 | echo "Checking if 'tuned' package is installed..."
|
5 | 11 | if ! rpm -q tuned &>/dev/null; then
|
6 | 12 | echo "'tuned' is not installed. Installing now..."
|
@@ -73,11 +79,18 @@ sudo tuned-adm active
|
73 | 79 | current_user=$(whoami)
|
74 | 80 |
|
75 | 81 | # Configure ulimit for the user
|
76 |
| -LIMITS_FILE="/etc/security/limits.d/${current_user}.conf" |
77 |
| -echo "Configuring ulimit settings for user ${current_user} in $LIMITS_FILE" |
78 |
| -cat << EOF | sudo tee "$LIMITS_FILE" |
79 |
| -${current_user} soft nofile 65536 |
80 |
| -${current_user} hard nofile 65536 |
| 82 | +# LIMITS_FILE="/etc/security/limits.d/${current_user}.conf" |
| 83 | +# echo "Configuring ulimit settings for user ${current_user} in $LIMITS_FILE" |
| 84 | +# cat << EOF | sudo tee "$LIMITS_FILE" |
| 85 | +# ${current_user} soft nofile 65536 |
| 86 | +# ${current_user} hard nofile 65536 |
| 87 | +# EOF |
| 88 | + |
| 89 | +# configue all user ulimit in /etc/security/limits.conf |
| 90 | +echo "Configuring ulimit settings in /etc/security/limits.conf" |
| 91 | +cat << EOF | sudo tee -a /etc/security/limits.conf > /dev/null |
| 92 | +* soft nofile 65536 |
| 93 | +* hard nofile 65536 |
81 | 94 | EOF
|
82 | 95 |
|
83 | 96 | # Apply ulimit settings immediately
|
|
0 commit comments