才剛決解那台 DL380 G4的磁帶機問題!
後續才又發現,我忘了設定成每次開機都能自動註冊SCSI裝置,好抓到磁帶機.
以前用RHEL版本,有個檔案叫 rc.local 能讓我們開機過程中,自動去執行它.
也就是把 載入 st 模組,註冊SCSI裝置等動作,寫到 rc.local 檔中.
那我就不必每次重新開機,就手動去啓用磁帶機!
有點像是windows下的 [開始>程式集>啓動]目錄,
你想在開始用電腦前,就自動執行好那些程式或指令.
只要放捷徑在裡頭,開機的過程中,就能自行運作起來.
BUT~我現在可是改用openSUSE了啊!
發現它居然没有 rc.local 檔案可以利用.
找了一下系統目錄,真的不是我眼花,是真的SUSE不用 rc.local 這檔案.
真是TMA @ # $ % & ~
SUSE是改成使用比較嚴謹的作法!
配合開機過程,分別有四個檔案,讓系統管理者運用.
如下所列:
boot.local
halt.local
before.local
after.local
boot.local 和 halt.local這兩個,望文生義,可以推論是配合開機和關機時的 script .
before.local 和 after.local 則是以 runlevel 那為依據配合著運用.
而且 before.local 和 after.local 預設不存在於系統中,需要自己去創建.
那麼 rc.local 是等同於那一個檔案呢?
在RHEL系統中,其實 rc.local 檔案,等於是runlevel 程序中的 S99.
所以呢? rc.local 應該和 boot.local 功能類似,但不完全等於.
也應該可以用 after.local 來達到 rc.local 的效果!
真的想要在SUSE中運用 rc.local ,乾脆就比照RHEL作法,寫成和 /etc/init.d/* 一樣的 script .
以下擷自官網文件,以為參考:
+============================================================+
Hi. I was missing a rc.local (as in redhat/fedora) in order to launch
some programs/daemons AFTER the whole system has booted. I found
"/etc/init.d/boot.local", but there we can read:
# /etc/rc.d/boot.local
#
# Here you should add things, that should happen directly
# after booting before we're going to the first run level.
This is, things are launched BEFORE going into the first runlevel. In
fedora's rc.local, things are launched AFTER the system has booted:
# /etc/rc.d/rc.local
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
Well, I've made a script that simulates Fedora's rc.local. I show it
since it can be useful for many people. It would be nice if Suse guys
include something similar into next releases of Suse.
Steps to simulate rc.local in Suse:
1) Create a "/etc/rc.d/rclocal" script, with this content:
----------------------------
#! /bin/sh
## This script simulates redhat's rc.local (Add commands at the end)
### BEGIN INIT INFO
# Provides: rclocal
# Required-Start: $local_fs $remote_fs $network
# X-UnitedLinux-Should-Start: $ALL
# Required-Stop:
# X-UnitedLinux-Should-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Simulates rc.local
# Description: Simulates redhat's rc.local: contains
# commands to execute after system has booted (all services are already
# available)
### END INIT INFO
## Execute ony when service is started
case "$1" in
start)
## commands will be executed
;;
*)
exit 0
;;
esac
# vvvvv Add your commands bellow this line vvvvv
----------------------------
2) Add executable permision: chmod +x rclocal
3) Create symlink to make it easy to find: ln -s rclocal rc.local
4) Activate the service by using yast2:
yast2 > System > Runlevel editor > rclocal > Enable
You can add/remove commands to /etc/rc.d/rc.local anytime you wish.
+============================================================+
最後,回歸到那個開機自動抓磁帶機的問題!
基本上,我只要寫兩行!
modprobe st
echo "engage scsi" > /proc/driver/cciss/cciss0
目前先寫到 boot.local 試試!
不行的話,就真的要自建 rc.local 了.