samedi 29 novembre 2014

Start sh script on startup in Linux Mint


I'm new to Linux, so not sure how to do what I want.


I have my_script.sh (executable, of course) like this:



#!/usr/bin/env bash
mate-terminal -e "bash -c 'cd /home/my_user/ruby_projects/my_app/';'rails s';exec $SHELL"


This script should open terminal, change current directory to the given one, start rails application without closing after that.


If I open terminal, go to the directory of the script, run ./my_script.sh - everything works perfectly and exactly how I want it to work, but every time I boot I have to do this manually.


So I went to Control center -> Startup Applications -> Add -> browsed my shell script, gave name -> Add


After that I restarted system and... :( Everything what I see is a few blinks on the screen (that is the opening and closing of mate-terminals) - everything happens so quickly that I can not see what it shows (however, all terminals should remain opened!). And, of course, no rails apps are started. All terminals are closed. How to fix this?


Update: at first my thought was that not all processes that were needed for rails apps started and that is why terminals simply closed, so I tried ty add sleep 10 for the script to wait till everything boots properly, but that changed nothing - blinking was just delayed by 10 seconds.



Aucun commentaire:

Enregistrer un commentaire