How to run a Linux Terminal command at startup

16,358

Solution 1

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

Solution 2

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.

Share:
16,358
David Gölzhäuser
Author by

David Gölzhäuser

Updated on June 04, 2022

Comments

  • David Gölzhäuser
    David Gölzhäuser almost 2 years

    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
    
  • David Gölzhäuser
    David Gölzhäuser almost 11 years
    Hm, it wont work, please check ma original post, I added the script I have now.
  • mh00h
    mh00h almost 11 years
    does running sudo (or rvmsudo) /home/pi/siriproxy server from a command line work for you? After that what happens- does it release the terminal back to you so that you can continue issuing commands, or is it captured by siriproxy?
  • David Gölzhäuser
    David Gölzhäuser almost 11 years
    @mhOOh If I type rvmsudo /home/pi/siriproxy server I get Permission denied
  • mh00h
    mh00h almost 11 years
    It sounds like your problem isn't in the init script, but being able to run siriproxy to start with. What do you do to get it to start in the past? This isn't any different than cd'ing to the directory and then running the command. Did it work for you before, and does it now?
  • David Gölzhäuser
    David Gölzhäuser almost 11 years
    It worked before and now with the commands i posted in the main Post. My problem is that I have to cd in the siriproxy directory and then execute rvmsudo siriproxy server to start the proxy