2013-05-07 222 views
3

我喜歡在啓動時啓動我的Raspberry Pi上的Siriproxy服務器。我在終端輸入如何在啓動時運行Linux終端命令

  1. cd siriproxy

  2. rvmsudo siriproxy server

開始Siriproxy。 有沒有辦法在啓動時運行命令?

非常感謝,

大衛

這是我編輯的腳本:

#!/bin/sh -e 
# 
# rc.local 
# 
# This script is executed at the end of each multiuser runlevel. 
# Make sure that the script will "exit 0" on success or any other 
# value on error. 
# 
# In order to enable or disable this script just change the execution 
# bits. 
# 
# By default this script does nothing. 

# Print the IP address 
_IP=$(hostname -I) || true 
if [ "$_IP" ]; then 
    printf "My IP address is %s\n" "$_IP" 
fi 

#I added this line 
/home/pi/siriproxy server 

exit 0 
/etc/init.d/cron start 
+0

考慮'的/ etc/init.d'創建一個腳本。 – devnull 2013-05-07 13:49:09

+0

@devnull不,因爲我不知道該怎麼做,而且我是Linux新手。 – 2013-05-07 14:25:36

回答

1

您可以添加在以root身份運行到/etc/rc.local中的腳本命令,然後他們將在啓動時運行。 (http://ubuntuforums.org/showthread.php?t=1822137

從你的樹莓派一個終端,運行:

sudo nano /etc/rc.local 

出口0行之前添加以下內容:

/path/to/siriproxy server 

您可以通過鍵入

得到siriproxy的路徑
which siriproxy 

或根據你的pi如何安裝siriproxy,它可能是不管你cd'd的完整路徑,然後添加「siriproxy」到最後。

保存文件並重新啓動以查看它的工作!希望這有助於。

+0

嗯,它不會工作,請檢查馬原來的帖子,我添加了我現在的腳本。 – 2013-05-09 13:11:59

+0

確實從命令行爲你運行'sudo(或rvmsudo)/ home/pi/siriproxy server'嗎?之後會發生什麼 - 是否將終端釋放回給您,以便您可以繼續發出命令,或者是否由siriproxy捕獲? – mh00h 2013-05-09 14:54:28

+0

@mhOOh如果我輸入rvmsudo/home/pi/siriproxy服務器,我得到權限被拒絕 – 2013-05-09 15:42:53

1

嘗試

screen -S ttlp 
cd /home/pi/siriproxy 

然後

rvm siriproxy server 

我沒有嘗試這樣做呢,我會在我的皮的一個安裝它,並幫助你。

問候, IC0NIC