简体   繁体   中英

How to run a Linux Terminal command at startup

I like to start my Siriproxy server on my Raspberry Pi on startup. I have to type

  1. cd siriproxy

  2. rvmsudo siriproxy server

in the Terminal to start the Siriproxy. Is there a way to run the command on the startup?

Thanks a lot,

David

This is the script I edited:

#!/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

You can add commands that are run as root to the /etc/rc.local script, and they will then be run at boot-up. ( http://ubuntuforums.org/showthread.php?t=1822137 )

From a terminal on your raspberry pi, run:

sudo nano /etc/rc.local

Add the following before the exit 0 line:

/path/to/siriproxy server

You can get the path of siriproxy by typing

which siriproxy

or depending on how your pi has siriproxy installed, it could be the full path of whatever you cd'd to, then adding "siriproxy" to the end.

Save the file and reboot to see it work! Hope this helped.

Try

screen -S ttlp
cd /home/pi/siriproxy

then

rvm siriproxy server

I haven't tried this yet, I will install it on one of my Pi's and help you.

Regards, IC0NIC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM