0

I wrote this .bat script:

ssh sderdm_evgeny@sderdm.beget.tech
cd /home/s/sderdm/mysite/public_html/core/__custom-scripts
php7.4 test.php

There is no password in the code to connect via SSH because I have an RSA key.

As a result, when I run the .bat script, I connect via SSH and that's it. Only the first line is executed. And the rest - no.

If I open cmd myself and write all the commands in turn, then the PHP script will start and execute. How can I make it start and execute from a .bat file? What am I doing wrong?

I use a standard ssh client from Windows 10. Maybe I need some special one?

user153742
  • 313
  • 2
  • 17

1 Answers1

0

You need to "send" your commands to remote machine, instead of running them after connecting.

This SO have more details. You can run something like ssh sderdm_evgeny@sderdm.beget.tech 'bash -s' < local_script.sh

Orifjon
  • 915
  • 8
  • 25