nacos
cat > /usr/lib/systemd/system/nacos.service <<'EOF'
[Unit]
Description=nacos server
After=network.target
[Service]
Type=forking
User=root
Environment="JAVA_HOME=/opt/java/jdk1.8.0_391"
ExecStart=/opt/nacos/bin/startup.sh -m standalone
ExecStop=shutdown.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now nacos
redis
cat > /usr/lib/systemd/system/redis.service <<'EOF'
[Unit]
Description=Redis persistent key-value database
After=network.target
[Service]
Type=forking
User=root
ExecStart=/opt/redis/bin/redis-server /opt/redis/bin/redis.conf
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now redis
rabbitmq-server
cat > /usr/lib/systemd/system/rabbitmq-server.service <<'EOF'
[Unit]
Description=RabbitMQ broker
After=syslog.target network.target
[Service]
Type=forking
User=root
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/erlang/bin:/opt/rabbitmq_server-3.13.1/sbin:/root/bin"
ExecStart=/opt/rabbitmq_server-3.13.1/sbin/rabbitmq-server -detached
ExecStop=/opt/rabbitmq_server-3.13.1/sbin/rabbitmqctl shutdown
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now rabbitmq-server
kkFileView
cat > /usr/lib/systemd/system/kkFileView.service <<'EOF'
[Unit]
Description=kkFileView server
After=network.target
[Service]
Type=forking
User=root
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/erlang/bin:/opt/rabbitmq_server-3.13.1/sbin:/root/bin"
ExecStart=/opt/kkFileView-4.3.0/bin/startup.sh
ExecStop=/opt/kkFileView-4.3.0/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now kkFileView
nginx
cat > /usr/lib/systemd/system/nginx.service <<'EOF'
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/opt/nginx/sbin/nginx -s reload
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now nginx
tomcat
cat > /usr/lib/systemd/system/tomcat.service <<'EOF'
[Unit]
Description=tomcat server
After=network.target
[Service]
Type=forking
User=root
Environment="JAVA_HOME=/opt/java/jdk1.8.0_371"
Environment="CLASSPATH=.:/opt/jdk1.8.0_371/lib/dt.jar:/opt/jdk1.8.0_371/lib/tools.jar"
Environment="PATH=/opt/jdk1.8.0_371/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin"
ExecStartPre=sleep 10
ExecStart=/opt/apache-tomcat-8.5.75/bin/startup.sh
ExecStop=/opt/apache-tomcat-8.5.75/bin/shutdown.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now tomcat
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 基于systemd配置服务开机自启
发表评论 取消回复