Shell script is set to start at boot
1. Copy the disable_smt.sh script to the /etc/init.d/ directory
cat disable_smt.sh
#!/bin/bash
# 关闭cpu超线程
echo off > /sys/devices/system/cpu/smt/control
cp disable_smt.sh /etc/init.d/
chmod +x /etc/init.d/disable_smt.sh
2. Use the update-rc.d command to add the script to the startup sequence.
update-rc.d disable_smt.sh defaults
3. Remove the startup configuration and stop the script from running on startup
update-rc.d -f disable_smt.sh remove
4. View the service list
# service --status-all | grep disable_smt.sh
[ - ] disable_smt.sh
- [+] – The service with this flag is currently running.
- [–] – The service with this flag is not currently running.
5. Check service status
service disable_smt.sh status
service disable_smt.sh start