注意事项:
该脚本使用于启动多个mysql实例的环境,如果想管理单个MySQL进程,只需要将“%i”换成具体的参数就好(mysql单实例管理可参考:http://blog.csdn.net/shen2308/article/details/78492460)。
[Unit]
Description=MySQL Multi Server for instance %i
After=syslog.target
After=network.target
[Service]
User=mysql
Group=mysql
Type=forking
ExecStart=/usr/bin/mysqld_multi start %i
ExecStop=/usr/bin/mysqld_multi stop %i
Restart=always
PrivateTmp=true
[Install]
WantedBy=multi-user.target
#管理命令
systemctl start/stop/status/restart mysql@3306.service
[Unit]
Description=Tomcat of rapapi
After=syslog.target network.target
[Service]
#指定用户
User=root
Group=root
Type=forking
#因为tomcat使用信号管理进程,所以需要指定pid文件
PIDFile=/usr/share/apache-tomcat-7.0.72/tomcat.pid
ExecStart=/usr/share/apache-tomcat-7.0.72/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
管理命令: systemctl start/stop/status/restart ProcessName.service
[Unit]
Description=Jenkins Control With Resin
After=syslog.target
After=network.target
[Service]
User=root
Group=root
ExecStart=/bin/bash /root/resin-3.1.12/bin/httpd.sh
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
[Unit]
Description=Redmine Control
After=syslog.target
After=network.target
[Service]
User=redmine
Group=redmine
#指定虚拟环境文件
EnvironmentFile=-/home/redmine/redmine-2.5.1/rails.env
WorkingDirectory=/home/redmine/redmine-2.5.1
ExecStart=/usr/local/rvm/src/rvm/rubies/ruby-2.0.0-p648/bin/ruby /home/redmine/redmine-2.5.1/script/rails server webrick -e production -p 4000
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
[Unit]
Description=Open Falcon Agent Service
After=network.target
[Service]
WorkingDirectory=/home/falcon/agent
ExecStart=/home/falcon/agent/falcon-agent -c /home/falcon/agent/cfg.json >> /dev/null 2>&1
StandardOutput=null
Restart=on-failure
RestartSec=15
[Install]
WantedBy=multi-user.target
[Unit]
Description=Cynpmjs Manage
After=network.target
[Service]
User=cynpm
Group=cynpm
Environment=PATH=/usr/bin:/usr/local/bin:/home/cynpm/.nvm/versions/node/v6.11.5/bin
WorkingDirectory=/home/cynpm/workspace/cynpm/cynpmjs
ExecStart=/home/cynpm/.nvm/versions/node/v6.11.5/bin/node /home/cynpm/workspace/cynpm/cynpmjs/dispatch.js
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target
参考: http://www.ruanyifeng.com/blog/2016/03/node-systemd-tutorial.html
[Unit]
Description=test_redis redis server service
After=network.target
[Service]
KillMode=control-group
ExecStop=/bin/kill -SIGTERM $MAINPID
Type=forking
PIDFile=/home/adai/redis/6601/redis_6601.pid
WorkingDirectory=/home/adai/redis
ExecStart=/usr/bin/redis-server /home/adai/redis/test_redis_6601.conf
Restart=on-failure
RestartSec=300
User=adai
Group=adai
# 最大5000个连接数
LimitNOFILE=5032
[Install]
WantedBy=multi-user.target
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
# [ftp]
# path = /home/ftp
# comment = ftp export area
uid = nobody
gid = nobody
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
log file = /var/log/rsyncd.log
[m_log]
path=/data/logs/
ignore erros
read only = false
list = false
hosts allow=10.9.12.2
hosts deny=*
说明:rsync服务只对指定ip开放连接权限,提升服务的安全性!!!
(adsbygoogle = window.adsbygoogle || []).push({});