编写服务:
vi /usr/lib/systemd/system/mysql-proxy-readwrite.service
[Unit]
Description=Mysql Proxy read write
After=rc-local.service
[Service]
Type=forking
ExecStart=/data/mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit/bin/mysql-proxy --defaults-file=/data/mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit/mysql-proxy-readwrite.cnf
ExecReload=/usr/bin/pkill mysql-proxy && /data/mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit/bin/mysql-proxy --defaults-file=/data/mysql-proxy-0.8.5-linux-glibc2.3-x86-64bit/mysql-proxy-readwrite.cnf
ExecStop=/usr/bin/pkill mysql-proxy
Restart=on-failure
RestartSec=42s
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存退出
chmod 754 /usr/lib/systemd/system/mysql-proxy-readwrite.service