Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 273
David Gölzhäuser Avatar asked Sep 05 '25 03:09

David Gölzhäuser


2 Answers

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.

like image 83
mh00h Avatar answered Sep 07 '25 21:09

mh00h


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

like image 34
IC0NIC Avatar answered Sep 07 '25 22:09

IC0NIC