1C.Linux system commands

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Aug 28, 2015
Company:

Hello.
How can i execute a system command on Linux from 1C? The task is to execute the following command:
udevadm info --query=all --name=/dev/sda | grep ID_SERIAL_SHORT
and to get hard drive serial number from 1C. I will be grateful for any help!

 
#2
People who like this:0Yes/0No
Administrator
Rating: 13
Joined: Oct 3, 2019
Company:

Hello Samir,

you can try to do something like this:


Code
System("udevadm info --query=all --name=/dev/sda | grep ID_SERIAL_SHORT >> temp.txt");
textReader = New TextReader;
textReader.Open("/home/username/temp.txt");
line = textReader.ReadLine();
While line <> Undefined Do 
   
EndDo;


That is, first we give the command to write the serial number of the disk to the file, and then we read the data from this file.

 
Subscribe
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.