Reputation: 5705
I set up an OpenShift application and set up my local PuTTY to connect to the server via SSH. Everything works fine, but I don't know how to run a few commands (mainly alias
) after I connected to the server automatically (I don't want to copy&paste the same commands everytime I connect).
On my local linux shell I can use .bashrc
, but this doesn't seem to work on OpenShift. I can't write a file in my home directory (/var/lib/openshift/[some letters and numbers]/
) and I don't know the right place to put this file. Does anybody know where I have to put a file which will be run everytime I login?
I'd prefer a solution which doesn't involve my local SSH software as I'm connecting to this OpenShift application from different machines.
Upvotes: 3
Views: 1604
Reputation: 10025
This has to be done in .bashrc or .profile or .bash_profile files. As you say they don't work then you can have a script in a file, scp that file to the remote server and then run when you ssh in a single command.
I have not used openshift but have used aws ec2 instances alot with ruby scripts,
ssh ubuntu@ec2-address ruby basic-auto.rb
The above command excutes the ruby file after the ssh. You can have a script in any language or may be a bash file(.sh) which executes after ssh.
Upvotes: 0
Reputation: 2807
You can use your .bash_profile
located in your $OPENSHIFT_DATA_DIR.
Upvotes: 10