# How to execute script on balena ssh login to container?

**URL:** <https://forums.balena.io/t/how-to-execute-script-on-balena-ssh-login-to-container/349822>\
**Category:** balenaOS\
**Created:** [October 22, 2021, 1:54pm UTC](https://forums.balena.io/t/how-to-execute-script-on-balena-ssh-login-to-container/349822 "2021-10-22T13:54:09Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![alexanderkjones](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@alexanderkjones](https://forums.balena.io/u/alexanderkjones)\
**Post date:** [October 28, 2021, 7:55pm UTC](https://forums.balena.io/t/how-to-execute-script-on-balena-ssh-login-to-container/349822/7 "2021-10-28T19:55:46Z")

</div>

After a bit of digging on the ssh -t options I found this [known issue](https://github.com/balena-io/balena-cli/issues/1482#issuecomment-624278963) if I’m not mistaken @nucleardreamer ?

I’ve been looking for an easy way to run scripts on ssh login and this was helpful:  
[Medium: Using Automator to Insert text with a Shortcut Key on Mac](https://medium.com/macoclock/using-automator-to-insert-text-with-a-shortcut-key-on-mac-a-step-by-step-guide-b0c30fa2c7c2)

I’ve been able to add shortcuts for common scripts like `pytest --disable-pytest-warnings` since the ssh shell does not remember previous commands in the same way basic terminal does. The challenge with testing is that the container you are testing also restarts each time you update the code or the tests, causing a loop of ssh back into the container and running the test script again. Any other insights on this appreciated.

---

_[View the full topic](https://forums.balena.io/t/how-to-execute-script-on-balena-ssh-login-to-container/349822)._
