Unable to start the PLCNext service via SSH in bash script

Hi,

I have created a small script to help myself to easily build, deploy and start a runtime C++ application on the PLCNext (AXC F 2152). I have encountered a small problem while executing it. Namely, the PLCNext service seem not to start after invoking the command via a bash script:

ssh -tt plcnext ‘sudo /etc/init.d/plcnext start’

Surprisingly, I do receive the system output that the service has started successfully, but that does reflect the real situation because the D diode on the controller is still the only one that is blinking and the runtime/PLCNext project does not execute. If the service is started explicitly via an SSH session (without prior stop of it), the PLCNext service starts normally.

I wanted to check with you whether this is a expected behavior and the fault lies on my side, or whether it is simply a bug.

Kind regards,
Michael Czorniej

Hello Michael,

seems like the problem is that the service is killed as soon as the Remote Session is terminated.

keeping the Session open temporariely fixed it:

ssh -tt admin@192.168.1.10 ‘sudo /etc/init.d/plcnext restart & sleep 100’

But you will notice it stopping the PLCnext Runtime as soon as the sleep time is exceeded.

I guess this is a configuration issue of the SSH Daemon we have to look into this further.
I also guess that this behavior is as intended - i have t o verify this - .

Edit:
Seems to work like this.

ssh [root@192.168.1.10](mailto:root@192.168.1.10) "/etc/init.d/plcnext restart &

or
ssh admin@192.168.1.10 “echo password | sudo -S /etc/init.d/plcnext restart &”

Something about the -tt and sudo password prompt seems to cause the issue.

Dear Oliver,

Thanks for the reply, unfortunately the two last commands executed via SSH do not make any effect on the PLCNext. Seems like indeed the controller terminates the command as soon as the SSH session is terminated, what happens instantly after sending the command.

Luckily for me, I have switched to making C++ components in Eclipse right now, since I have noticed that it will be much more suitable for my project. Therefore, I do not have a need to SCP any files over to the PLCNext now.

Kind regards,
Michael Czorniej