chkconfig 命令
假设编写脚本autostart.sh
#!/bin/sh
#chkconfig: 2345 80 90
#description:开机自动启动的脚本程序
# 开启redis服务 端口为6379
/usr/local/service/redis-2.8.3/src/redis-server --port 6379 &
脚本第一行 “#!/bin/sh” 告诉系统使用的shell;
脚本第二行 “#chkconfig: 2345 80 90” 表示在2/3/4/5运行级别启动,启动序号(S80),关闭序号(K90);
脚本第三行 表示的是服务的描述信息
设定执行权限
cd /etc/rc.d/init.d/
chmod +x autostart.sh
添加启动项
chkconfig --add autostart.sh
chkconfig autostart.sh on
chkconfig --add name 添加一个chkconfig管理的service,并在/etc/rc[0-6].d 目录下添加相应的符号链接(symbolic links)。
chkconfig --del name 从chkconfig 管理名单中删除该service,并且删除 /etc/rc[0-6].d 目录下所有与之关联的符号链接(symbolic links)。
添加环境变量
vi /etc/profile
在末尾加入:
PATH=$PATH:/usr/local/php7/bin
export PATH
11.使改动立即生效
source /etc/profile
查找文件 find . -name "*.log" 在当前目录查找以 .log 结尾的文件。
sed -i 查找替换