2016-07-28 103 views
5

我試圖在Ubuntu 16.04 LTS上使OrientDB作爲守護進程運行(啓動時啓用)。問題是,系統似乎在我告訴它開始後立即調用stop。我有這個systemd服務文件完全一樣OrientDB文檔中建議:systemd在Ubuntu上啓動後立即停止OrientDB 16.04

[Unit] 
Description=OrientDB Server 
After=network.target 
After=syslog.target 

[Install] 
WantedBy=multi-user.target 

[Service] 
Type=forking 
ExecStart=$ORIENTDB_HOME/bin/orientdb.sh start 
ExecStop=$ORIENTDB_HOME/bin/orientdb.sh stop 
ExecStatus=$ORIENTDB_HOME/bin/orientdb.sh status 

orientdb.log:

  .           
      .`  `         
      ,  `:.         
     `,` ,:`         
     .,. :,,          
     .,, ,,,          
    . .,.::::: ````         :::::::::  ::::::::: 
    ,` .::,,,,::.,,,,,,`;;      .: :::::::::: ::: ::: 
    `,. ::,,,,,,,:.,,.` `      .: :::  ::: :::  ::: 
    ,,:,:,,,,,,,,::. `  `   ``  .: :::  ::: :::  ::: 
     ,,:.,,,,,,,,,: `::, ,, ::,::` : :,::` :::: :::  ::: ::: ::: 
     ,:,,,,,,,,,,::,: ,, :. : :: : .: :::  ::: :::::::  
     :,,,,,,,,,,:,:: ,, :  : :  : .: :::  ::: ::::::::: 
    `  :,,,,,,,,,,:,::, ,, .:::::::: :  : .: :::  ::: :::  ::: 
    `,...,,:,,,,,,,,,: .:,. ,, ,,   :  : .: :::  ::: :::  ::: 
    .,,,,::,,,,,,,: `: , ,, :  ` :  : .: :::  ::: :::  ::: 
     ...,::,,,,::.. `: .,, :, : :  : .: ::::::::::: :::  ::: 
      ,::::,,,. `: ,, ::::: :  : .: :::::::::  :::::::::: 
      ,,:` `,,.         
      ,,, .,`         
     ,,.  `,           GRAPH DATABASE 
     ``  `.               
       ``           orientdb.com 
       `          
pid file detected, killing process 

系統日誌:

Jul 28 18:56:34 ubuntu systemd[1]: Starting OrientDB Server... 
Jul 28 18:56:34 ubuntu orientdb.sh[17487]: Starting OrientDB server daemon... 
Jul 28 18:56:34 ubuntu systemd[1]: Created slice User Slice of orientdb. 
Jul 28 18:56:34 ubuntu systemd[1]: Starting User Manager for UID 999... 
Jul 28 18:56:34 ubuntu systemd[1]: Started Session c5 of user orientdb. 
Jul 28 18:56:34 ubuntu systemd[17497]: Reached target Timers. 
Jul 28 18:56:34 ubuntu systemd[17497]: Reached target Paths. 
Jul 28 18:56:34 ubuntu systemd[17497]: Reached target Sockets. 
Jul 28 18:56:34 ubuntu systemd[17497]: Reached target Basic System. 
Jul 28 18:56:34 ubuntu systemd[17497]: Reached target Default. 
Jul 28 18:56:34 ubuntu systemd[17497]: Startup finished in 23ms. 
Jul 28 18:56:34 ubuntu systemd[1]: Started User Manager for UID 999. 
Jul 28 18:56:34 ubuntu orientdb.sh[17508]: Stopping OrientDB server daemon... 
Jul 28 18:56:34 ubuntu systemd[1]: Started Session c6 of user orientdb. 
Jul 28 18:56:34 ubuntu systemd[1]: Started OrientDB Server. 
Jul 28 18:56:34 ubuntu systemd[1]: Stopping User Manager for UID 999... 
Jul 28 18:56:34 ubuntu systemd[17497]: Reached target Shutdown. 
Jul 28 18:56:34 ubuntu systemd[17497]: Starting Exit the Session... 
Jul 28 18:56:34 ubuntu systemd[17497]: Stopped target Default. 
Jul 28 18:56:34 ubuntu systemd[17497]: Stopped target Basic System. 
Jul 28 18:56:34 ubuntu systemd[17497]: Stopped target Timers. 
Jul 28 18:56:34 ubuntu systemd[17497]: Stopped target Paths. 
Jul 28 18:56:34 ubuntu systemd[17497]: Stopped target Sockets. 
Jul 28 18:56:34 ubuntu systemd[17497]: Received SIGRTMIN+24 from PID 17536 (kill). 
Jul 28 18:56:34 ubuntu systemd[1]: Stopped User Manager for UID 999. 
Jul 28 18:56:34 ubuntu systemd[1]: Removed slice User Slice of orientdb. 

任何想法?

+0

你是否按照此鏈接指南(http://orientdb.com/docs/2.1/Unix-Service.html)? – lsavio

+0

是的,這就是問題所在。我跟着文檔(見上面的腳本),它不工作:)。 – austinsmorris

+0

好的,你可以在Github上打開一個問題嗎?..謝謝。 – lsavio

回答

0

只要在systemd服務單元中包裝自定義初始化腳本(orientdb.sh ,server.sh,shutdown.sh),您將遇到奇怪且難以調試的問題。

相反,您應該閱讀這些腳本,瞭解他們如何啓動OrientDB並僅重現服務單元中的必需內容。

0

我添加了一個用戶&組orientdb到系統和下面systemd腳本中使用(假設orientdb安裝在的/ opt/orientdb):

[Unit] 
Description=OrientDB Server 
After=network.target 
After=syslog.target 

[Install] 
WantedBy=multi-user.target 

[Service] 
User=orientdb 
Group=orientdb 
ExecStart=/opt/orientdb/bin/server.sh 
ExecStop=/opt/orientdb/bin/shutdown.sh 
ExecReload=/bin/kill -HUP $MAINPID 
0

如果你運行的服務器和關閉窗口,服務器將被關閉。將它與NOHUP(server.sh)一起使用,如果關閉該窗口,它將繼續運行。

我有同樣的問題,運氣好的話

0

我有同樣的問題,用了OpenSuse 42.1飛躍和OrientDB 2.2.7。 羅伯託的答案解決了它。見the issue on GitHub

相關問題