a. Python script, which work fine, when i execute it by root.
Code: Select all
#!/usr/bin/python
import sys
sys.path.append("/usr/lib64/python2.7/")
import os
import time
class sender:
def send(self, device, message):
fd = os.open(device, os.O_RDWR)
print(device)
print(length)
print(message)
print(fd)
time.sleep(1)
os.write(fd, "AT+CMGF=0\r\n")
time.sleep(1)
os.write(fd, "AT+CMGS=" + length + "\r\n")
time.sleep(1)
os.write(fd, message + "\032\r\n")
os.close(fd)
def main(argv):
print("here")
senderInstance = sender()
senderInstance.send(argv[1], argv[2], argv[3])
return 0
if __name__ == '__main__': main(sys.argv)
b. asp net core application with iron python, which execute script:
#!/usr/bin/python
import sys
sys.path.append("/usr/lib64/python2.7/")
import os
import time
class sender:
def send(self,device,length,message):
print("start")
print(device)
print(length)
print(message)
fd = os.open(device, os.O_RDWR)
print(fd)
time.sleep(1)
os.write(fd, "AT+CMGF=0\r\n")
time.sleep(1)
os.write(fd, "AT+CMGS=" + length + "\r\n")
time.sleep(1)
os.write(fd, message + "\032\r\n")
os.close(fd)
print("stop")
This is ps aux output:
YourTexasBenefits
ps aux | grep service
apache 2618 1.0 4.2 3008012 79932 ? SLsl 13:38 0:01 /usr/bin/dotnet /opt/service/Service.dll
So, i added apache user to dialout group, but it didn't work. What am i doing wrong?
Thank you.