LNMP VPS自动备份网站发送邮件
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
lnmp官方自带的有backup.sh脚本,但是该脚本只能上传ftp,不能发送邮件,稍微修改了下,然后可以自己发送到指定邮箱,省事了,定时任务需要cron配合。
yum install -y mutt
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运行权限还是过大,随后调整了下,将执行权限授权给指定用户就可以了。
sudo groupadd wireshark
sudo chgrp wireshark /usr/bin/dumpcap
sudo chmod 4755 /usr/bin/dumpcap
sudo gpasswd -a hmilyld wireshark
OK,完成!
cd $CATALINA_HOME/bin
tar -xvf commons-daemon-native.tar.gz
cd commons-daemon-x.x.x-native-src/unix
./configure
make
cp jsvc ../..
useradd -s /sbin/nologin tomcat
chown -R tomcat:tomcat $CATALINA_HOME
cp $CATALINA_HOME/bin/daemon.sh /etc/init.d/tomcat
由于service命令执行时不会获取环境变量的值,所以将变量增加至tomcat中vi /etc/init.d/tomcat
增加
JAVA_HOME=/opt/jdk
CATALINA_HOME=/opt/tomcat
TOMCAT_USER=tomcat
service tomcat start
service tomcat stop
至此,tomcat就以普通用户(tomcat)启动了,以后记得所有tomcat需要加载的目录和文件权限都是tomcat就可以了。