linux开机自动启动一些服务

本文发布时间: 2019-Mar-22
linux 开机自动启动一些服务,有很多方法,下面介绍两种1 要开机 运行只需将它加入到 rc local ,一般为 etc rc d rc local 在其中加入linux 开机自动启动一些服务,有很多方法,下面介绍两种1.要开机 运行只需将它加入到 rc.local ,一般为/etc/rc.d/rc.local 在其中加入以下行:例子是开机后自动创建一个bbb.txt#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/localsh /test/init.sh下面是/test/init.sh中的内容#! /bin/bashtouch /test/bbb.txt2.第二种是做成一个服务linux的服务放置在/etc/init.d目录下,新建一个initb服务1. /etc/init.d/initb 的内容如下#!/bin/bash# chkconfig: 2345 10 90# description: myservice ....touch /test/initb.txt3、运行chmod +x /etc/rc.d/init.d/initb,使之可直接执行4、运行chkconfig --add initb,把该服务添加到配置当中5、运行chkconfig --list initb,可以查看该服务进程的状态6.重启后,在/test目录下就会出现initb.txt


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:09pm
栏目列表