2013-05-07 221 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