Reputation: 21877
Every day I do the following commands:
[0] Start terminal
memcached
redis-server
memcached
devo
cd /some/path
rails s --port=3002
cd /other/path
rails s --port=3000
Can these steps be accomplished in a single script? I'm losing my mind doing these steps every time I restart my system
Upvotes: 4
Views: 3329
Reputation: 107040
Well, if you don't mind using xterm
as your terminal, you can do this in your shell scripts:
xterm -e $command
You can also use the open
command which is unique to the Mac:
open -a /Applications/Utilities/Terminal.app $command #Full pathname to $command!
For example:
open -a /Applications/Utilities/Terminal.app /usr/bin/vim
Works.
You can also use a shell script:
open -a /Applications/Utilities/Terminal.app /home/david/foo.sh
What I haven't figured out is how to open a command that requires a command line parameter. If you have to do that, you'll have to stick to xterm
.
Upvotes: 0
Reputation: 4843
Create an applescript. You will just need to run the applescript and it'll do all that for you :
tell application "Terminal"
activate
do script "memcached" in window 1
do script "redis-server" -- Each do script opens a new window
do script "memcached"
do script "devo"
do script "cd "
do script "rails s --port=3002" in window 1 -- does script in last opened window
do script "cd "
do script "rails s --port=3000" in window 1 -- does script in last opened window
end tell
Save it as an Application so you can double click it to run it. You could also assign it to start on system start or even to a shortcut with a necessary third party program.
Upvotes: 10