我写了这个创建文件夹的小BASH脚本,解压缩wordpress并为站点创建数据库.
最后一步实际上是安装wordpress,这通常涉及将浏览器指向install.PHP并在GUI中填写表单.
我想从BASH shell执行此操作,但无法弄清楚如何调用wp_install()并将其传递给它所需的参数:
-admin_email
-admin_password
-weblog_title
-用户名
(install.PHP中的第85行)
#!/bin/bash
#ask for the site name
echo "Site Name:"
read name
# make site directory under splogs
mkdir /var/www/splogs/$name
dirname="/var/www/splogs/$name"
#import wordpress from dropBox
cp -r ~/DropBox/Web/Resources/wordpress/Core $dirname
cd $dirname
#unwrap the double wrap
mv Core/* ./
rm -r Core
mv wp-config-sample.PHP wp-config.php
sed -i 's/database_name_here/'$name'/g' ./wp-config.php
sed -i 's/username_here/root/g' ./wp-config.php
sed -i 's/password_here/mypassword/g' ./wp-config.php
cp -r ~/DropBox/Web/Resources/wordpress/Themes/responsive $dirname/wp-content/t$
cd $dirname
CMD="create database $name"
MysqL -uroot -pmypass -e "$CMD"
如何更改脚本以自动运行安装程序而无需打开浏览器?