linux centos 5 lamp(apache mysql php) yum自动安装shell脚本
手头有N台linux centos 5的服务器,每次配置都要打很多命令,不想这么烦下去了。
自己写了一个自动安装脚本,包括了apache mysql php的自动Yum安装。最后还设置了防火墙。
记录一下,想要源文件的可以跟我要。
别忘了,给这个文件这是一个执行权限,简单的来就是chmod 7777
#! /bin/bash
yum -y install httpd php mysql mysql-server php-mysql
echo ‘install httpd,php,mysql,php success’
# define auto run
/sbin/chkconfig httpd on
/sbin/chkconfig –add mysqld
/sbin/chkconfig mysqld on
echo ‘define httpd mysqld autorun success’
# start service
/sbin/service httpd restart
/sbin/service mysqld restart
echo ’start httpd mysqld success’
#define mysql password
mysqladmin -u root password ‘ismurray’
echo ‘define mysql password success’
# install apache ext
yum -y [...]
如何找回Windows显示桌面图标快捷方式
本人是个糊涂人,经常把xp的显示桌面的快捷方式,然而用的有thinkpad,键盘没有windows键,这就郁闷了,没得替换。找了很多发现了制作Windows XP显示桌面图标快捷方式。
步骤如下:
新建文本,在里边输入如下
[shell]
command=2
iconfile=explorer.exe,3
[taskbar]
command=toggledesktop
单击“文件”,选择“另存为”,命名为“显示桌面.scf ”。
此时就会出现一个显示桌面的图标。哈哈,这下方便了,可以把它放到任何想放的地方,我当然就放在快速启动了
如何在Linux用chmod来修改所有子目录中的文件属性?
在linux下,我们可以用chmod更改文件或目录属性
例如: chmod mode file|dir
当文件夹具备相同的权限,有些文件夹下面套着好几层目录,一层一层的用chmod不是办法
我们可以这样改变所有子目录的权限: chmod mode dir -R
我们也可以用SHELL脚本实现
#!/bin/sh
find /murray -type d -exec chmod 755 {} \;
find /murray -type f -exec chmod 644 {} \;
注: /murray为你要更改的目录。
怎么用好Linux的Shell命令
1、cat /etc/shells
查看计算机上可用的shell
2、编写shell,保存为firstscript
#! /bin/bash
# This is a test.
echo -n Your current directory is:
pwd
echo $HOME
echo Your current directory is:
pwd
#END.
3、运行firstscript
$ /bin/bash firstscript
如果找不到文件 使用pwd查看当前目录
$ /bin/bash pwd/firstscript
可见当前运行结果。
4、可以修改firstscript为执行
$chmod a+x firstscript
此时输入$ ./firstscript即可
上面的shell没有交换,我们可以进行交互,如下:
#!/bin/sh
echo -n Please input your ID:
read id_var
echo -n Please input your password:
read password
echo User ID = $id_var
echo password = $password
if [ $password = "admin" ]; then
echo “password is right”
else
echo “password is [...]

