To get the script to run in terminal, I have to select the option to open in terminal and write sh script name.sh
Is there a way I can reduce that to a single step, i.e. a launcher that automatically opens the script in a terminal after logging as a root ? I've tried to look it up on Google, but I haven't found any useful advice (perhaps I'm not executing the search properly).
Asked
Active
Viewed 1,588 times
0

user3476633
- 11
- 4
-
you mean running the script as start up script. – Rahul Mar 29 '14 at 21:02
-
I mean to run it after logging in – user3476633 Mar 29 '14 at 21:06
-
Yep, that's it. See my answer below. – Rahul Mar 29 '14 at 21:07
-
Is that ok with bash ?? – user3476633 Mar 29 '14 at 21:10
-
see my edited answer and yes it's ok for bash. – Rahul Mar 29 '14 at 21:16
1 Answers
1
I think what you mean is running your script as start up script. In that case place the script you want to run in the /etc/init.d
directory and make the script executable with command chmod 755 scriptname.sh
.
See the below related threads for more information
https://askubuntu.com/questions/290099/how-to-run-a-script-during-boot-as-root
How to run a shell script at startup
EDIT:
if you want to run your script after your login is successful then you need to place your script in ~/.bash_profile
. See this related post
-
I mean include your script path there (OR) call your script from `bash_profile` – Rahul Mar 29 '14 at 21:22
-
`bash_profile` itself is a script. So you just need to call your script from there like `/bin/bash /path/scriptname.sh`. – Rahul Mar 29 '14 at 21:32
-
@user3476633, if this answer helped you then try accepting it as answer. – Rahul Mar 30 '14 at 17:10
-
I know you did your best but nothing happened when editing the bash profile ... I edit it by "nano ~/.bash_profile and nothing happen – user3476633 Mar 30 '14 at 18:29
-
-
-