Author |
Post |
|
#1 Fri Oct 30, 2009 16:57, 186 months ago.
|
Member
Registered: Sep 2009
Location: east java, Indonesia
|
Operating system name and version: ubuntu 8.04 Version of smsd: 3.1.5 Smsd installed from: sources / package repository / from elsewhere... Name and model of a modem / phone: sierra 815U Interface: USB
hi, expert, I have created web application with PHP and smstools3. smstools3 is great sms gateway. easy and simple. I have a problem when I tried to read my regular_run_statfile from my web aplication. I've changed file mode of reguler_run_statfile with 777, but when smsd refresh and create this file again, this file back to old mode. mode of reguler_run_statfile : -rw-r--r-- 1 root root.
this is my smsd.conf : devices = GSM1 logfile = /var/log/smsd.log loglevel = 7 failed = /var/spool/sms/failed incoming = /var/spool/sms/incoming report = /var/spool/sms/report sent = /var/spool/sms/sent #delaytime = 60
[GSM1]
#init = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 #init = ATE0+CPMS="SM"+CNMI=2,0,0,2,1 device = /dev/ttyUSB3 incoming = yes outgoing = yes report = yes #pin = baudrate = 115200 regular_run_interval = 60 regular_run_cmd = AT+CUSD=1,"*388#",15 regular_run_statfile = /var/spool/sms/reguler_run_statfile
how to file canreguler_run_statfile be read with a web application? thanks
regard
farid
|
|
#2 Fri Oct 30, 2009 17:25, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
As you want to just read (not write or append) the file, mode 644 is enough. Probably you have tried to open it with write permission, which will fail. For example this simple PHP script can read the content of a file:
|
|
#3 Fri Oct 30, 2009 22:41, 186 months ago.
|
Member
Registered: Sep 2009
Location: east java, Indonesia
Topic owner
|
thanks keke for your answer. I've changed reguler_run_statfile permission with 644. I have can read this file from web application, but 1 minute later this file can not be read again. error message on browser : All content:
Warning: file_get_contents(/var/spool/sms/reguler_run_statfile) [function.file-get-contents]: failed to open stream: Permission denied in /var/www/tesphp/view.php on line 6
when i checked on terminal, file permission have changed into -rw-r-----. how to changed reguler_run_statfile with permission 644 permanently ?
regard
farid
|
|
#4 Sat Oct 31, 2009 12:20, 186 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Ok, I checked this from sources and there is mode 640 used as a fixed value.
You could modify the sources. Edit file smsd.c and find the line:
if ((fd = open(DEVICE.dev_rr_statfile, O_APPEND|O_WRONLY|O_CREAT, 0640)) >= 0)
Change it to:
if ((fd = open(DEVICE.dev_rr_statfile, O_APPEND|O_WRONLY|O_CREAT, 0644)) >= 0)
I will include this fix in the next version.
|
|
#5 Sun Nov 01, 2009 09:12, 186 months ago.
|
Member
Registered: Sep 2009
Location: east java, Indonesia
Topic owner
|
thanks keke, its work !!!
regard
farid
|