标签 linux 下的文章

lnmp官方自带的有backup.sh脚本,但是该脚本只能上传ftp,不能发送邮件,稍微修改了下,然后可以自己发送到指定邮箱,省事了,定时任务需要cron配合。

安装mutt

yum install -y mutt

创建.muttrc

set envelope_from=yes
set from="backup@hmilyld.com"
set realname="hmilyld"
set use_from=yes

- 阅读剩余部分 -

version: '3'

services:
  mysql:
    container_name: jjit_mysql
    restart: always
    image: mysql:5.7
    ports:
      - 3306:3306
    volumes:
      - ./mysql/data:/var/lib/mysql
      - ./mysql/my.cnf:/etc/my.cnf
    environment:
      MYSQL_ROOT_PASSWORD: password

  nginx:
    container_name: jjit_nginx
    restart: always
    image: nginx:latest
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/www:/usr/share/nginx/html
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/cert:/etc/nginx/cert
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/log/error.log:/var/log/nginx/error.log
    links:
      - tomcat:t1

  tomcat:
    container_name: jjit_tomcat
    restart: always
    image: tomcat:latest
    ports:
      - 8080:8080
      - 8009:8009
      - 8443:8443
    volumes:
      - ./tomcat/webapps:/usr/local/tomcat/webapps
      - ./tomcat/conf:/usr/local/tomcat/conf
      - ./tomcat/logs:/usr/local/tomcat/logs
    links:
      - mysql:m1

yum -y install wget
wget -N --no-check-certificate https://raw.githubusercontent.com/hombo125/doubi/master/ssr.sh && chmod +x ssr.sh && bash ssr.sh

备用脚本

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh && chmod +x ssr.sh && bash ssr.sh

bbr安装

wget -N --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && bash ./bbr.sh

ubuntu下安装wireshark后,如果以普通用户执行,会报错无权限,随后使用sudo执行,可以正常执行,但是会提示存在风险,毕竟使用root运行权限还是过大,随后调整了下,将执行权限授权给指定用户就可以了。

添加wireshark用户组

sudo groupadd wireshark

将dumpcap更改为wireshark用户组

sudo chgrp wireshark /usr/bin/dumpcap

让wireshark用户组有root权限使用dumpcap

sudo chmod 4755 /usr/bin/dumpcap

将需要使用的用户名(hmilyld)加入wireshark用户组

sudo gpasswd -a hmilyld wireshark

OK,完成!

编译安装jsvc

cd $CATALINA_HOME/bin
tar -xvf commons-daemon-native.tar.gz
cd commons-daemon-x.x.x-native-src/unix
./configure
make
cp jsvc ../..

创建运行tomcat的普通用户tomcat

useradd -s /sbin/nologin tomcat

修改tomcat目录用户及用户组

chown -R tomcat:tomcat $CATALINA_HOME

将tomcat加入service服务

cp $CATALINA_HOME/bin/daemon.sh /etc/init.d/tomcat

修改tomcat,增加环境变量

由于service命令执行时不会获取环境变量的值,所以将变量增加至tomcat中
vi /etc/init.d/tomcat
增加

JAVA_HOME=/opt/jdk
CATALINA_HOME=/opt/tomcat
TOMCAT_USER=tomcat

启动or关闭

service tomcat start
service tomcat stop

至此,tomcat就以普通用户(tomcat)启动了,以后记得所有tomcat需要加载的目录和文件权限都是tomcat就可以了。