- LSB 必須儲存在以下目錄
-
/etc/ha.d/resource.d
/etc/init.d
- 新增一個服務 myservice
-
$ sudo vim /etc/init.d/myservice
#!/bin/bash
param=$1
if [ "start" == "$param" ] ; then
echo "myservice will start from here"
myinitial.sh
exit 0
elif [ "stop" == "$param" ] ; then
echo "myservice will stop from here"
exit 0;
elif [ "status" == "$param" ] ; then
echo "myservice will show status here"
exit 0;
else
echo "no such command $param"
exit 1;
fi
- 編輯 myservice 增加執行屬性
-
$ sudo chmod +x /etc/init.d/myservice
- myservice 使用方式
- 測試 /etc/init.d/myservice start 會不會啟動 myinitial.sh
-
usage:
$ sudo /etc/init.d/myservice start | stop | status
- 把 myservice 寫到 heartbeat 設定檔 /etc/ha.d/haresources
-
$ sudo vim /etc/ha.d/haresources
Node1 IPaddr::10.128.8.158/24/eth0 drbddisk::r0 Filesystem::/dev/drbd0::/drbd/coverity::ext4::noatime myservice