簡體   English   中英

如何在啟動時運行Linux Terminal命令

[英]How to run a Linux Terminal command at startup

我喜歡在啟動時在我的Raspberry Pi上啟動我的Siriproxy服務器。 我要打字

  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

您可以將以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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM