一、docker
cpp
systemctl enable docker.service
二、容器
加参数:--restart=always
如果容器已存在,修改容器:
cs
docker update --restart=always 容器ID(或者容器名)
三、redis
1.注册服务
cs
vi /etc/systemd/system/redis.service
2.服务配置文件
cs
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/redis-5.0.7/src/redis-server /usr/local/redis/redis-5.0.7/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
3.服务自启动
cs
systemctl enable redis
四、minio
1.minio配置文件,配置用户名和密码
cs
vi /home/minio/conf/minio.conf
输入内容:
cs
MINIO_ACCESS_KEY="minioadmin"
MINIO_SECRET_KEY="Aa123456@admin"
2.注册服务
cs
vi /etc/systemd/system/minio.service
3.服务配置文件
cs
[Unit]
Description=Minio
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
[Service]
# User and group
User=root
Group=root
EnvironmentFile=/home/minio/conf/minio.conf
ExecStart=/usr/local/soft/minio server --address :9000 --console-address :9090 /home/minio/data
ExecReload=/bin/kill -HUP $MAINPID
# Let systemd restart this service always
Restart=always
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
TimeoutStopSec=5
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
4.服务自启动
cs
systemctl enable minio
五、java jar
1.注册服务
cs
vi /etc/systemd/system/exam.service
2.服务配置文件:
cs
[Unit]
Description=exam
After=network.target
[Service]
User=root
Type=simple
ExecStart=/usr/local/java/jdk1.8.0_341/bin/java -jar /home/app/exam/backend/exam.jar
Restart=on-failure
[Install]
WantedBy=multi-user.target
3.服务自启动
cs
systemctl enable exam