[英]How to run a Linux Terminal command at startup
我喜欢在启动时在我的Raspberry Pi上启动我的Siriproxy服务器。 我要打字
cd siriproxy
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
您可以将以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,它可能是你想要的任何东西的完整路径,然后添加“siriproxy”到最后。
保存文件并重新启动以查看它是否正常工作! 希望这有帮助。
尝试
screen -S ttlp
cd /home/pi/siriproxy
然后
rvm siriproxy server
我还没试过,我会把它安装在我的一个Pi上并帮助你。
此致,IC0NIC
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.