Update initialization steps

This commit is contained in:
wmcheng 2020-03-01 17:53:56 +08:00
parent b4a3524286
commit d1b5210555
1 changed files with 64 additions and 2 deletions

View File

@ -206,8 +206,16 @@ $ sudo logrotate -d /etc/logrotate.conf # 確認系統是否有使用 /etc/logro
### 四、主機開機網站自動起始 ### 四、主機開機網站自動起始
```sh ```sh
# 開機網站自動起始 # 開機網站自動起始
$ sudo vim /etc/init.d/orbit # 內容附註 orbit $ sudo vim /etc/init.d/orbit # 內容附註 orbit
$ sudo chmod 755 /etc/init.d/orbit $ sudo chmod 755 /etc/init.d/orbit
$ update-rc.d orbit defaults
$ sudo vim /etc/init.d/rc.local #內容見附註 rc.local1
$ sudo chmod 755 /etc/init.d/rc.local
$ sudo vim /etc/rc.local #內容見附註 rc.local
$ sudo chmod 755 /etc/rc.local
$ update-rc.d rc.local defaults
$ sudo systemctl start orbit
$ sudo systemctl start rc.local
# #
``` ```
@ -438,4 +446,58 @@ setup)
exit 1 exit 1
;; ;;
esac esac
``` ```
```txt
# 附註 rc.local1
#! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
```
```txt
# 附註 rc.local1
#! /bin/sh
sudo mongod --config /etc/mongod.conf &
exit 0
```