修改rc.d 文件

ftp配置文件,默认安装路径/usr/local/pureftpd/etc/pure-ftpd.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

# starting up workerman
touch /var/lock/subsys/local
nohup sh /data/wwwroot/www.anrenyiliao.com/startup.sh >/data/wwwroot/www.anrenyiliao.com/logs/workerman-startup-log.txt 2>&1

新建shell脚本

startup.sh

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash
###
 # @Author: Lance Ma
 # @Date: 2020-08-17 23:35:41
 # @LastEditTime: 2020-08-18 12:58:25
 # @LastEditors: Please set LastEditors
 # @Description: In User Settings Edit
 # @FilePath: .\startup.sh
###
ulimit -HSn 102400
nohup php /data/wwwroot/www.anrenyiliao.com/vendor/GatewayWorker/start.php start -d >/dev/null 2>&1 &
touch /data/wwwroot/www.anrenyiliao.com/logs/workerman-log.txt

shutdown.sh

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
###
 # @Author: lance Ma
 # @Date: 2020-08-18 13:50:43
 # @LastEditTime: 2020-08-18 13:57:03
 # @LastEditors: Please set LastEditors
 # @Description: In User Settings Edit
 # @FilePath: .\shutdown.sh
###
php /data/wwwroot/www.anrenyiliao.com/vendor/GatewayWorker/start.php stop -d >/dev/null 2>&1 &
touch /data/wwwroot/www.anrenyiliao.com/logs/workerman-stop-log.txt

新建Service

/usr/lib/systemd/system/lancema-stopSrv.service
lancema-stopSrv.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[Unit]
Description=poweroff cust
After=getty@tty1.service display-manager.service plymouth-start.service
Before=systemd-poweroff.service systemd-reboot.service systemd-halt.service
DefaultDependencies=no
# This works because it is installed in the target and will be
# executed before the target state is entered
# Also consider kexec.target

[Service]
ExecStart=/data/wwwroot/www.anrenyiliao.com/shutdown.sh
Type=forking

[Install]
WantedBy=poweroff.target
WantedBy=reboot.target
WantedBy=halt.target