Linux System basic setting script
2011-04-17 20:21
453 查看
#! /bin/bash
#Author: Matt Song
#Date: 2011/04/16
#Variable Setting:
ntpserver=ntp.api.bz
#show variable:
echo "NTP Server: $ntpserver"
#echo "others..."
sleep 1
echo -e "\e[1;32m"
cat << EOF
+--------------------------------------------------------------+
| === Welcome to Centos System init === |
+--------------------------------------------------------------+
+----------------------Author: Matt Song-----------------------+
EOF
echo -e "\e[1;33m"
cat << EOF
+--------------------------------------------------------------+
| === Turning off services === |
+--------------------------------------------------------------+
EOF
for i in `chkconfig --list | grep 3:on | awk '{print $1}'`
do
echo -e "\e[1;33m========== Processing Service: \e[1;31m$i\t\e[1;33m============="
case $i in
sshd | syslog | network | crond | iptables )
echo -e "\e[1;32mSkipping Services: $i"
;;
*)
echo -e "\e[1;31mTurning off $i"
chkconfig $i off
service $i stop
;;
esac
done
echo ""
echo -e "\e[1;31mRunning Services: \e[0m"
chkconfig --list | grep 3:on
# Setting ntpdate's Crontab, Sync at 00:00 everyday
echo -e "\e[1;33m"
cat << EOF
+--------------------------------------------------------------+
| === Setting NTP === |
+--------------------------------------------------------------+
EOF
echo -e "\e[1;31mInstalling NTP...\e[0m"
yum -y install ntp
echo
echo -e "\e[1;32mInstallation finished, Setting NTP..."
echo "00 00 * * * /usr/sbin/ntpdate $ntpserver > /dev/null 2>&1 " >> /var/spool/cron/root
echo -e "\e[1;32mNTP setting is done! below is the crontab list:"
echo -en "\e[0m"; crontab -l
echo ""
echo -e "\e[1;32mAll the Jobs have been Done! :)"
echo -e "\e[0m"
#Author: Matt Song
#Date: 2011/04/16
#Variable Setting:
ntpserver=ntp.api.bz
#show variable:
echo "NTP Server: $ntpserver"
#echo "others..."
sleep 1
echo -e "\e[1;32m"
cat << EOF
+--------------------------------------------------------------+
| === Welcome to Centos System init === |
+--------------------------------------------------------------+
+----------------------Author: Matt Song-----------------------+
EOF
echo -e "\e[1;33m"
cat << EOF
+--------------------------------------------------------------+
| === Turning off services === |
+--------------------------------------------------------------+
EOF
for i in `chkconfig --list | grep 3:on | awk '{print $1}'`
do
echo -e "\e[1;33m========== Processing Service: \e[1;31m$i\t\e[1;33m============="
case $i in
sshd | syslog | network | crond | iptables )
echo -e "\e[1;32mSkipping Services: $i"
;;
*)
echo -e "\e[1;31mTurning off $i"
chkconfig $i off
service $i stop
;;
esac
done
echo ""
echo -e "\e[1;31mRunning Services: \e[0m"
chkconfig --list | grep 3:on
# Setting ntpdate's Crontab, Sync at 00:00 everyday
echo -e "\e[1;33m"
cat << EOF
+--------------------------------------------------------------+
| === Setting NTP === |
+--------------------------------------------------------------+
EOF
echo -e "\e[1;31mInstalling NTP...\e[0m"
yum -y install ntp
echo
echo -e "\e[1;32mInstallation finished, Setting NTP..."
echo "00 00 * * * /usr/sbin/ntpdate $ntpserver > /dev/null 2>&1 " >> /var/spool/cron/root
echo -e "\e[1;32mNTP setting is done! below is the crontab list:"
echo -en "\e[0m"; crontab -l
echo ""
echo -e "\e[1;32mAll the Jobs have been Done! :)"
echo -e "\e[0m"
相关文章推荐
- Mac os system custom shell script, linux server upload project script writing
- Basic Fedora Linux Firewall Configuration (system-config-firewall)
- [From Linux Toy] inxi– bash script to get system information
- Linux Shell Script (一) -- Basic Concepts
- Linux下c++调用自己编写的matlab函数:通过shell script system command实现
- How to check system status with basic Linux utilities.
- Linux system startup script for Jenkins(Hudson)
- OpenCV multiple version on Linux ENV script of setting
- Linux system service detail info.
- Linker Script in Linux 4
- ubuntu system setting no everthing
- Linux - fsck命令修复文件系统 | Using command fsck to repair file system
- 重要的Linux内核文件介绍-/boot/system.map
- python os.system os.popen 区别【os.popen执行linux命令tail -100 filename可以打开linux中文件内容】
- Linux script命令来记录你所有终端命令操作
- linux 查找系统最大分区挂载点的shell script
- RH033 Unit 10 Basic System Configuration Tools
- system.setting-全局变量数据监听
- linux command Line and shell script bible(笔记二_非用户变量)