LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run multiple arguments with systemexec and CMD

Hi all

 

Trying to change folder permissions through labview. The commands I am trying to run are:

 

[open terminal]

ssh admin@[ip address]

chown lvuser:ni /path/to/folder/i/want/to/alter

 

chmod 777 /path/to/folder/i/want/to/alter

 

So far I have tried a variety of suggestions ive found on this forum, including trying ' cmd /c ssh admin@[ip address] & chown lvuser:ni /path/to/folder/i/want/to/alter & chmod 777 /path/to/folder/i/want/to/alte ' but this doesnt seem to work either. Does anyone have suggestions on how to do this? This code is running on a windows machine, and SSH'ing into the RT to change folder permissions on it.

 

Thanks

 

0 Kudos
Message 1 of 6
(622 Views)

First, does this command work if you actually SSH into the rt target (I suggest using Putty for that)?

Don't  you need sudo to do a chosen?

Also if you apply to the folder, I don't think it applies to the folder's content so you might want to add arguments like * (to apply to existing files) and -R (to also include sub-folders)

You canaso use WinSCP, it offers a basic UI if you're not a command line fan


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 6
(594 Views)

I'd try to make a .bat file and run that through system exec

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(570 Views)

Does this work?

ssh admin@host "chown lvuser:ni /path/to/folder/i/want/to/alter && chmod 777 /path/to/folder/i/want/to/alter"

 

I cannot try with a Linux machine, but this works with a Windows client to a Windows host and LabVIEW 2020 64 bit:

ssh User@host "mkdir test && mkdir test2"

 

You have to use '&&' to chain commands. Adding '&' will put execution in the backgound.

0 Kudos
Message 4 of 6
(554 Views)

If you need to do this from a LabVIEW application running on Windows, you could use the command line version of Putty, call Plink.

 

Documentation:

https://the.earth.li/~sgtatham/putty/0.79/htmldoc/Chapter7.html#plink

 

Download page:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

There are 32 and 64-bit versions, use the one that matches your LabVIEW bitness.

 

For sending multiple commands, try separating them using a semicolon " ; ".

0 Kudos
Message 5 of 6
(545 Views)

Thanks for the replies all. 

 

This needs to happen on either the RT or a computer linked to the RT. 

 

This needs to happen programatically, so I cant have anyone access the computer since its remote, to run these commands. I wanted to do this on startup. 

 

I posted a similar question here but didnt get far.

 

 

 

 

0 Kudos
Message 6 of 6
(529 Views)