centos 7上systemctl脚本编写

nginx: [Unit] Description=nginx - high performance web server Documentation=http://nginx.org/en/docs/ After=network.target remote-fs.target nss-lookup.target [Service] Typ...

nginx:

[Unit]

Description=nginx - high performance web server

Documentation=http://nginx.org/en/docs/

After=network.target remote-fs.target nss-lookup.target


[Service]

Type=forking

PIDFile=/webdata/opt/local/tengine/logs/nginx.pid

ExecStartPre=/webdata/opt/local/tengine/sbin/nginx -t -c /webdata/opt/local/tengine/conf/nginx.conf

ExecStart=/webdata/opt/local/tengine/sbin/nginx -c /webdata/opt/local/tengine/conf/nginx.conf

ExecReload=/bin/kill -s HUP $MAINPID

ExecStop=/bin/kill -s QUIT $MAINPID

PrivateTmp=true


[Install]

WantedBy=multi-user.target




php-fpm:

[Unit]

Description=The PHP FastCGI Process Manager

After=syslog.target network.target


[Service]

Type=forking

PIDFile=/webdata/opt/local/php71/var/run/php-fpm.pid

ExecStart=/webdata/opt/local/php71/sbin/php-fpm --daemonize --fpm-config  /webdata/opt/local/php71/etc/php-fpm.conf

ExecReload=/bin/kill -USR2 $MAINPID

ExecStop=/bin/kill -SIGINT $MAINPID


[Install]

WantedBy=multi-user.target



php-fpm.conf


[global]

pid = run/php-fpm.pid

error_log = log/php-fpm.log

syslog.facility = daemon

log_level = debug

rlimit_files = 51200

include=/webdata/opt/local/php71/etc/php-fpm.d/*.conf


[www]
user=www
group = www
catch_workers_output = yes
;listen = 127.0.0.1:9000
listen = /var/php71/php-cgi.sock
listen.owner = www
listen.group = www
listen.mode = 0660
pm = static 
rlimit_files = 51200
pm.max_children = 24
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3




mysqld:


[Unit]
Description=MySQL Server
Documentation=man:mysqld(8)
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

Type=forking

PIDFile=/var/run/mysqld/mysqld.pid

# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0

# Execute pre and post scripts as root
PermissionsStartOnly=true

# Needed to create system tables
ExecStartPre=/usr/bin/mysqld_pre_systemd

# Start main service
ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS

# Use this to switch malloc implementation
EnvironmentFile=-/etc/sysconfig/mysql

# Sets open_files_limit
LimitNOFILE = 5000

Restart=on-failure

RestartPreventExitStatus=1

PrivateTmp=false



  • 发表于 2018-03-23 13:57
  • 阅读 ( 56 )

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
石天
石天

437 篇文章

作家榜 »

  1. shitian 662 文章
  2. 石天 437 文章
  3. 每天惠23 33 文章
  4. 小A 29 文章