I have created one myscript.sh file as following

source ~/.profile  
cd $GOPATH/src  
revel run test/streetcom  

I need to run this file at startup after login.
I tried using startup application by creating a new field with command as the path of myscript.sh which is:


but it did not work. I want to run the above script on the terminal after login on startup. Is there any way to run this script on tmux session. I tried adding following line after #!/bin/ bash in myscript.sh file.

tmux new -s piwork 

Tmux session piwork got created but the remaining commands getting executed in another terminal window.

1 Answer 1


if you want to run the script at startup, do the following :

  1. Run sudo chmod +x /home/pi/myscript.sh to make your script executable.
  2. Open .bashrc file using sudo gedit ~/.bashrc or sudo nano ~/.bashrc
  3. Place the command that runs the script (./home/pi/myscript.sh) in the end of the file.
  4. Save and exit.

It should run on the next startup.

  • it is ./pi/home/myscript.sh Also, check the bath to your script, is it /pi/home/myscript or /home/pi/myscript?
    – singrium
    Commented May 23, 2018 at 9:16
  • Do you want it to run automatically after startup or what exactly? I am a bit confused now.
    – singrium
    Commented May 23, 2018 at 9:20
  • 1
    Firstly, one # in the beginning is enough. Second, there is no need to write sh before ./pi/home/myscript.sh Commented May 23, 2018 at 9:38
  • Yes, I want to run it after startup. But the thing is when my pi boots up it doesnt show anthing after login on the display. But after login into SSH session the script work just fine. Is there any way to run these commands on the terminal after login.
    – Karthik
    Commented May 23, 2018 at 10:05
  • 1
    The problem can be in the disabling login & password windows. You can check it by trying to run some 'echo "hello world", if it will also not run automatically - try to turn off disabling the password. Commented May 23, 2018 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .