centos配置開機自啟動實現(xiàn)過程
更新時間:2025年03月03日 10:35:11 作者:冰川_
以上內(nèi)容主要介紹了使用elasticsearch為例,編寫運行腳本、配置執(zhí)行權限及開機自啟動的方法,旨在為讀者提供參考
以elasticsearch為例子
寫實際運行的腳本
vi /home/iscas/autostart.sh
#!bin/bash su iscas<<! nohup /home/iscas/es/elasticsearch-6.1.3/bin/elasticsearch > /home/iscas/es/elasticsearch-6.1.3/logs/elasticsearch_start.log 2>&1 &
給執(zhí)行權限
chmod 777 /home/iscas/autostart.sh
配置開機自啟動
vi /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 sh /home/iscas/autostart.sh
給執(zhí)行權限
chmod 777 /etc/rc.d/rc.local
總結
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
CentOS下安裝python3.5+scrapy的方法步驟
本篇文章主要介紹了CentOS下安裝python3.5+scrapy的方法步驟,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-12-12

