문제

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.

도움이 되었습니까?

해결책

You can use your .bash_profile located in your $OPENSHIFT_DATA_DIR.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top