centos7新增开机启动脚本

cd /etc/init.d
vi startall.sh
里面的内容是:

# chkconfig: 2345 10 90 
# description: start myservice on boot
/usr/local/php/bin/php /var/www/lyjt_wtx_mg/html/Public/newmsg.php > /dev/null &

  

#chmod a+x startall.sh
# chkconfig --add startall.sh
# chkconfig startall.sh on
查看效果:如果startall.sh那一行的2345列都是on表示正常
# chkconfig --list

# chkconfig --list

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
nginx           0:off   1:off   2:on    3:on    4:on    5:on    6:off
php-fpm         0:off   1:off   2:on    3:on    4:on    5:on    6:off
startall.sh     0:off   1:off   2:on    3:on    4:on    5:on    6:off

  

 

posted @ 2023-05-24 17:10  tochenwei  阅读(73)  评论(0编辑  收藏  举报