若是用作好的安裝包安裝Openstack,啓動服務必定會想到用service nova-${api,network,compute}之類的,可是若是單純從lanuchpad,github上下載源碼安裝呢,就沒辦法。不過對照分析仍是能夠得出不少小技巧。python
就拿nova-api這個模塊來舉例:linux
(1)cat /etc/init.d/nova-api 這個就是service nova-api ${restart,start,stop}要用的腳本,關鍵代碼以下:git
/sbin/start-stop-daemon --start -b -c nova:nobody --make-pidfile --pidfile /var/run/nova/nova-api.pid --exec /usr/bin/nova-api -- --flagfile=/etc/nova/nova.conf --log-file=/var/log/nova/nova-api.log github
其實就是用start-stop-daemon去調用 /usr/bin/nova-api 而後給必定的參數。api
(2)查看/usr/bin/nova-apiui
#!/usr/bin/python
# EASY-INSTALL-SCRIPT: 'nova==2012.2','nova-api'
__requires__ = 'nova==2012.2'
import pkg_resources
pkg_resources.run_script('nova==2012.2', 'nova-api')spa
原來是運行了 nova egg包裏面的腳本 nova-api,rest
可貴找路徑,執行以下看看:orm
[root@xgtest nova]# python
Python 2.6.6 (r266:84292, Jun 18 2012, 14:18:47)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import nova
>>> print nova.__path__
['/usr/lib/python2.6/site-packages/nova-2012.2-py2.6.egg/nova']
>>> ip
在這裏能夠找到腳本:'/usr/lib/python2.6/site-packages/nova-2012.2-py2.6.egg/
[root@xgtest scripts]# pwd
/usr/lib/python2.6/site-packages/nova-2012.2-py2.6.egg/EGG-INFO/scripts
[root@xgtest scripts]#
[root@xgtest scripts]#
[root@xgtest scripts]# ll
total 152
-rw-r--r--. 1 root root 2659 Aug 22 11:16 nova-all
-rw-r--r--. 1 root root 1705 Aug 22 16:58 nova-api
-rw-r--r--. 1 root root 1470 Aug 22 11:16 nova-api-ec2
...............................
這就是咱們要的nova-api腳本,這個腳本是幹什麼的,是另一個topic了..