tp5 在Nginx部署转发机制htacess
#转发机制
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
#转发机制
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
原因:镜像源出现问题
修改镜像源:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
更换成阿里云镜像云即可
SELECT * from information_schema.columns where TABLE_SCHEMA='new_ejiegd_com' and COLUMN_NAME='uid'
其中new_ejiegd_com为数据库名
uid为字段名
ps -ef
ps aux
使用sort对CPU占用进行排序
ps aux|sort -nr -k3
sort #排序命令
-nr #默认使用字符串排序n代表使用数值进行排序 默认从小到大排序 r代表反向排序
-k3 #以第3列进行排序
把输入第一行删除然后剩余的行参与排序并去前10位
ps aux|grep -v PID|sort -nr -k3|head -n10
如需要显示PID则先运行输出第一行然后再进行排序
ps aux|head -n1;ps aux|grep -v PID|sort -nr -k3|head -n10
同理输出内存占用多的进程,内存参数在第四行
ps aux|head -n1;ps aux|grep -v PID|sort -nr -k4|head -n10
#关闭服务
public function closed(){
if(strpos(PHP_OS,"Linux")!==false){
#Linux套字
$exec_power ="kill -s 9 `ps -aux | grep queue| grep -v grep | awk '{print $2}'`";
//$exec_power ='cd '. ROOT_PATH .'; php think queue:restart';
}else if(strpos(PHP_OS,"WIN")!==false){
#Win套字
$exec_power ='cd /d '. ROOT_PATH .' & php think queue:restart ';
}else{
$this->error('未识别的操作系统');
}
#命令执行
$message ='';
try {
$message = shell_exec($exec_power);
} catch (\Exception $e) {
$message = $e->getMessage();
}
$this->success('关闭服务成功','',$exec_power);
}
#启动服务
public function powers(){
$id =$this->request->param('id');
$info=$this->model->where(array('id'=>$id))->find();
$daemon =1;
#获取标识
$job_code =$info['job_code'];
if(!empty($job_code)){
#判断win还是linux
if(strpos(PHP_OS,"Linux")!==false){
#Linux套字
if($daemon){
//$exec_power ='cd '. ROOT_PATH .'; php think queue:work --queue ' .$job_code.' --daemon';
//后台挂起 不同等待
$exec_power ='cd '. ROOT_PATH .'; php think queue:work --queue ' .$job_code.' --daemon > /dev/null 2> /dev/null &';
}else{
$exec_power ='cd '. ROOT_PATH .'; php think queue:work --queue ' .$job_code;
}
}else if(strpos(PHP_OS,"WIN")!==false){
#Win套字
if($daemon){
//$exec_power ='cd /d '. ROOT_PATH .' & php think queue:work --queue ' .$job_code.' --daemon';
$exec_power ='cd /d '. ROOT_PATH .' & start /B php think queue:work --queue ' .$job_code.' --daemon';
}else{
$exec_power ='cd /d "'. ROOT_PATH .'" & php think queue:work --queue ' .$job_code;
}
}else{
$this->error('未识别的操作系统');
}
#命令执行
$message ='';
if($daemon>0){
$message =pclose(popen($exec_power, 'r'));
//$message =shell_exec($exec_power);
}else{
try {
$message = shell_exec($exec_power);
} catch (\Exception $e) {
$message = $e->getMessage();
}
}
$this->success('启动成功','',$exec_power);
}else{
$this->error('未找到对应的任务标识');
}
}
批量杀死 queue:work 的进程
kill -s 9 `ps -aux | grep queue:work| grep -v grep | awk '{print $2}'`
查找大于10M的日志文件
find / -name "*.log" -size +10M
查找大于10M的日志文件并删除
find / -name "*.log" -size +10M -exec rm -rf {} \;
查找大于1M的日志文件并删除
find / -name "*.log" -size +1M -exec rm -rf {} \;
查找所有的日志文件并删除
find / -name "*.log" -exec rm -rf {} \;