Код: Выделить всё
powershell "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; H:\\\\scripts\\\\workstation\\\\headnode.ps1 -myUser username"
sudo su - ubuntu
sbatch -J job.sbatch
< /code>
Это работает, но я не могу воспроизвести с помощью Python, я попробовал < /p>
import expect
child = wexpect.spawn('powershell "Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; H:\\\\scripts\\\\workstation\\\\headnode.ps1 -myUser username"')
# Wait for Linux prompt
child.expect([r'\$', r'#', 'ubuntu@'], timeout=60)
# Run the commands
child.sendline('sudo su - ubuntu')
child.expect([r'#', 'ubuntu@'], timeout=30)
child.sendline('sbatch -J job.sbatch')
Подробнее здесь: https://stackoverflow.com/questions/797 ... -linux-aws
Мобильная версия