阿里云ubuntu下设置程序开机自动启动chkconfig
程序员文章站
2022-07-12 13:48:38
...
这里主要讲没有chkconfig命令时,ubuntu操作系统是如何进行设置程序开机自动启动,比如:开机启动nginx\php\mysql\memcached等非系统服务;
1、打开rc.local文件
# vi /etc/rc.local
2、在启动项最上方加这行命令才可以开机启动
touch /var/lock/subsys/local
示例如下:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
touch /var/lock/subsys/local
#php运行环境
/etc/init.d/php-fpm start
/etc/init.d/mysql start
/etc/init.d/nginx
#/data/webserver/nginx/sbin/nginx -c /data/webserver/nginx/conf/nginx.conf
#memcached服务器
/data/webserver/memcached/bin/memcached -d -c 1024 -m 64 -u www -p 11211 -P /tmp/memcached11211.pid
exit 0