Linux server setup software service boot. (Linux svn server-side settings service boot)

About Linux service from Kai, we are generally aware of the need to modify the script file rc.local.

Below, you can directly do gymnastics:

[root@byx-linux ~]# vim /etc/rc.d/rc.local

 

 This script is user defined boot program , you would like to be added after the system starts inside the execution of the script or script execution command.

 

Internet Method One: Create a script file (I tried not, but this idea is absolutely wrong, I may be operational problems.)

(1) In the Linux server with the directory (under (/ root path)) to create a script file. (I want to start from the program, I was named svn svn)

[root@byx-linux ~]# touch svn.sh

 

(2) into the script file, begin editing the script.

[root@byx-linux ~]# vim svn.sh

     

(3) Add about content

 #!/bin/bash
 /usr/bin/svnserve -d -r  /opt/svn/repositories

 

Here are a few things to look at:

Here svnserve service route on the safe side, it is best to write the absolute path , because when activated, environment variables might not loaded.

 

Absolute path how to check?

[root@byx-linux ~]# which svnserve

 

Execute permission (4) change the script
[root@byx-linux ~]# chmod 777 svn.sh

 

(5) added to the autorun file:
[root@byx-linux ~]# vim /etc/rc.d/rc.local

 

Add the script at the end of the path: /root/svn.sh
#!/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.

touch /var/lock/subsys/local
/root/svn.sh
~                                                                                                                                                             
~                                                                                                                                                             
"/etc/rc.d/rc.local" 16L, 551C  

 

(6) saved the best for rc.local file 777:
[root@byx-linux ~]# chmod 777 rc.local

 

(7) Restart the Linux server, restart the background process to see if there is svnver services:
[root@byx-linux ~]# ps -ef|grep svnserve
root       687     1  0 16:08 ?        00:00:00 /usr/bin/svnserve -d -r /home/svn/project/

 

 

The second method: Fill in direct command script execution (very simple, direct need from the start of the service execution command into the software inside rc.local file)

(1) directly edit rc.local file:

[root@byx-linux ~]# vim /etc/rc.d/rc.local

 

Add required from the start of the end of the script path:
#!/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.

touch /var/lock/subsys/local
/usr/bin/svnserve -d -r  /opt/svn/repositories
~                                                                                                                                                             
~                                                                                                                                                             
"/etc/rc.d/rc.local" 16L, 551C  
 
 
(2) preservation, to the best rc.local file 777:
[root@byx-linux ~]# chmod 777 rc.local

 

(3) Restart the Linux server, restart the background process to see if there is svnver services:
[root@byx-linux ~]# ps -ef|grep svnserve
root       687     1  0 16:08 ?        00:00:00 /usr/bin/svnserve -d -r /home/svn/project/
 
 
 
I use the second method, I can. The first method, later to find out the problem, and then update the article.
 
I hope to help you.
 
by without saying thanks.

Guess you like

Origin www.cnblogs.com/byx1024/p/12346024.html