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
[root@byx-linux ~]# chmod 777 svn.sh
[root@byx-linux ~]# vim /etc/rc.d/rc.local
#!/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
[root@byx-linux ~]# chmod 777 rc.local
[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
#!/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
[root@byx-linux ~]# chmod 777 rc.local
[root@byx-linux ~]# ps -ef|grep svnserve root 687 1 0 16:08 ? 00:00:00 /usr/bin/svnserve -d -r /home/svn/project/