diff --git a/README.md b/README.md index 3b8b5e7..062ac06 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ backup /home/rulingcom localhost/ ```sh $ sudo vim /etc/logrotate.d/orbit # 內容見附註 logrotate $ sudo logrotate -d /etc/logrotate.conf # 確認系統是否有使用 /etc/logrotate.d/orbit +$ sudo /usr/sbin/logrotate -f /etc/logrotate.conf #測試執行log壓縮程序,看是否能成功壓縮log ``` ```txt @@ -220,7 +221,7 @@ $ sudo logrotate -d /etc/logrotate.conf # 確認系統是否有使用 /etc/logro compress missingok notifempty - create 644 rulingcom rulingcom + copytruncate postrotate [ ! -f /run/nginx.pid ] || kill -USR1 `cat /run/nginx.pid` endscript @@ -232,7 +233,7 @@ $ sudo logrotate -d /etc/logrotate.conf # 確認系統是否有使用 /etc/logro compress missingok notifempty - create 644 rulingcom rulingcom + copytruncate postrotate [ ! -f /run/nginx.pid ] || kill -USR1 `cat /run/nginx.pid` endscript @@ -245,7 +246,7 @@ $ sudo logrotate -d /etc/logrotate.conf # 確認系統是否有使用 /etc/logro compress missingok notifempty - create 644 mongodb mongodb + copytruncate postrotate [ ! -f /var/lib/mongodb/mongod.lock ] || kill -SIGUSR1 `cat /var/lib/mongodb/mongod.lock` endscript @@ -265,13 +266,10 @@ $ 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 $ sudo systemctl enable mongod.service #ubuntu18.04以上適用(可在系統boot時,自動開啟mongo) -$ sudo mv /etc/init.d/mongod /etc/systemd/system/ && sudo systemctl enable mongod.service #如果sudo systemctl enable mongod.service失敗時 -$ sudo crontab -e #加入以下內容 -# @reboot /etc/init.d/orbit start -# @reboot service mongod restart - +$ sudo mv /etc/init.d/mongod /etc/systemd/system/ && sudo systemctl enable mongod.service +$ sudo crontab -e #加入以下#內容 +# @reboot /bin/bash -l -c "rm -f /tmp/mongodb-27017.sock && chown mongodb:mongodb /var/lib/mongodb/ -R && chown mongodb:mongodb /var/log/mongodb -R && /usr/sbin/service mongod restart && /etc/init.d/orbit restart" ``` ```txt @@ -553,13 +551,6 @@ case "$1" in esac ``` -```txt -# 附註 rc.local -#! /bin/sh -sudo mongod --config /etc/mongod.conf & -exit 0 -``` - ``` ### 五、網路設定