How to execute a robot file stored on remote machine, via a robot script?

Hi,
I want to automatically start django server on remote server. For that i have created a robotframework-djangolibrary robot file. Manually on remote server if i run this robot file, the server starts and works fine… BUT, i want to run this robot file from another robot file on my pc.
So like remotely executing a robot file to start the django server.
I run and get the log info in log.html, but after checking on remote machine, server isn’t running.

How to do that.

Hi Alexeino,

While there are probably many ways this can be achieved, the most obvious that springs to mind for me is to use SSHLibrary, ssh to the machine where you have robotframework-djangolibrary working and run the robot command in the ssh session.

Dave.

Actually i have tried using SSH library, I am doing like…

${activate_env}      C:/Users/lab/Documents/qxdm_wrapper/testenv/Scripts/activate
${start_django_server}     robot C:/Users/lab/Documents/qxdm_wrapper/Server-Start.robot

and to execute

image

I am getting all green in the log.html also getting prompts for the django starting. BUT
when checking the remote machine, Server isn’t running.
I tried to run a simple python script for test, that didn’t work too man.
Not sure what to do now.

btw, virtual environment is working just this robot script isn’t working.

is the django environment getting stopped when the robot script exits on the remote machine or perhaps when the ssh session is closed all the processes under the ssh session are killed by the os?

  • Perhaps try adding an & to the end of the ${start_django_server} string
  • if the django server can be started as a service instead of a process under the logged in ssh user then that might solve the process

Dave.

Since remote machine is Windows 10, can u suggest & alternative.

Hi Alexeino,

Option 1

On windows the command to start a service is:

net start servicename 

Likewise to stop a service:

net stop servicename 

When I searched for django as a service windows I found Django on windows: how to make Django run in CherryPy as a Windows service | Guguweb

But if you go that far you can probably just set the service to start automatically when windows starts on the VM, so you might not need to ssh into it to start django unless you are doing some django configuration first, so this might solve the original issue as well.

Option 2

Another option is to use the windows start command (the windows equivalent of the & in *nix environments

Windows - Run process on background after closing cmd

Dave.