あなたは、のコマンドの起動を追加する場合:
chmodの+ X /etc/rc.d/rc.localの
コマンドは、このファイルに/etc/rc.d/rc.localに書き込み
リブート
まず、カイ・サービスからのブートを追加
甲斐サービスからのブートでCentOSの7に追加する(例えばジェンキンスに)非常に便利な、2つのコマンドだけです。
$ systemctl enable jenkins.service #设置jenkins服务为自启动服务
$ sysstemctl start jenkins.service #启动jenkins服务
第二に、カイ・スクリプトからのブートを追加
サンプルスクリプト(スクリプトファイル)をhexo-sever.shするには、2つの一般的な方法がありますcentos7スクリプトに増やします。
bash #!/bin/bash cd /www/wwwroot/hexo nohup hexo s > test.log 2>&1 &
操作の具体例としては(最初からスクリプトを追加):
1、スクリプト実行権限を与えて(あなたのスクリプトのパスを/www/wwwroot/hexo/hexo-sever.sh)
$ chmod +x /www/wwwroot/hexo/hexo-sever.sh
図2に示すように、端部が開放に/etc/rc.d/rc.local又は/etc/rc.localのファイルは、以下の追加
SU -ユーザ-c「/www/wwwroot/hexo/hexo-sever.sh」
$ vim /etc/rc.local
$ su - user -c '/www/wwwroot/hexo/hexo-sever.sh'
3は、centos7には、/ etc / rc.dの/ rc.localに権限が低減され、次のコマンド実行権限付与を実行する必要があります
$ chmod +x /etc/rc.d/rc.local
特定の参照元のテキスト:https://www.tiance.club/post/2362243123.html