redis和nginx配置systemctl    

REDIS6.x:

[Unit]
Description=Redis Database
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/redis-6.2.1/src/redis-server /usr/local/redis/redis-6.2.1/redis.conf  --supervised systemd
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/usr/local/redis/redis-6.2.1/src/redis-cli shutdown
#ExecStop=/usr/local/redis/redis-6.2.1/src/redis-cli -a password shutdown 2>/dev/nullPrivateTmp=true[Install]
WantedBy=multi-user.target

 





NGINX:

[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/apps/nginx/logs/nginx.pid
ExecStartPre=/usr/bin/rm -f /usr/local/apps/nginx/logs/nginx.pid
ExecStartPre=/usr/local/apps/nginx/sbin/nginx -t
ExecStart=/usr/local/apps/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5KillMode=process
PrivateTmp=true[Install]
WantedBy=multi-user.target