Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

SysProcess.SysProcess.Execute.Command how to start linux program

pawel3410
2019-09-03
2019-09-06
  • pawel3410 - 2019-09-03

    If its possible to start linux programs from >Zitat:
    SysProcess.SysProcess.ExecuteCommand2
    function?
    Simple command like ```

    sudo reboot

    ``` is working but when I try to use program >Zitat:
    netcat
    then nothing happen. Even when I create script with netcat command and I will run this script from codesys its not working. When I run this script from shell its working properly.
    This is some codesys limitation or I am doing something wrong?
    Somebody try to start any linux program from codesys?

     
  • eschwellinger

    eschwellinger - 2019-09-04

    Hi,
    hm.. looks like a bug,
    I see if I add the command to /etc/CODESYSControl_User.cfg:

    [SysProcess]
    Command.0=shutdown
    Command.1=netcat

    and start the runtime manually ( to have more debug info), we see that netcat is executed, anyway somehow the result is not delivered to the SysProcessCommand2 in the IEC code.
    Seems a to be a bug.
    Please add a bugreport with your application attached to the store -> my question -> bugreport

    BR
    Edwin

    IMG: netcat.png

     
  • pawel3410 - 2019-09-04

    Thank you for your response.

    How do you get this debug info?

    Can You try command >Zitat:
    "echo message date +%s | nc -u -w 0 192.168.1.1 2000"

    This should send UDP message "message date +%s" to 192.168.1.1 on port 2000.
    In Your test program netcat was executed, but I cant send UDP message.
    If somethisg is not clear feel free to ask.

     
  • eschwellinger

    eschwellinger - 2019-09-05

    Hi,
    not sure what exactly you want to archive but I would recommend to send or receive UDP frames
    that way:
    l viewtopic.php?t=6625#p13743 l

    BR
    Edwin

     
  • pawel3410 - 2019-09-05

    In Your test program netcat was executed but the result was not delivered to the SysProcessCommand2 in the IEC code.
    Can You test again program netcat to for example send some UDP packet, it will be for shure that it was executed properly or not.
    When I try command ```

    "echo message date +%s | nc -u -w 0 192.168.1.1 2000"

    ``` UDP packet is not sended, probably netcat with this parameter is not executed.
    Can You explain how to run this debug mode from previous post?

    In CODESYSControl_User.cfg I have:
    [SysProcess]
    Command=AllowAll

     
  • eschwellinger

    eschwellinger - 2019-09-06

    Hi,
    I think it is not allowed to combine commands / echo + netcat

    stop the service by:
    sudo /etc/init.d/codesyscontrol stop

    start it manually by
    cd /var/opt/codesys
    sudo /opt/codesys/bin/codesyscontrol_armv6l_raspberry.bin -d /etc/CODESYSControl.cfg

    Once again I would recommend to do this UDP sending stuff by netbase services library like in the link in the upper post.

    BR
    Edwin

     

Log in to post a comment.