<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Thanks Dale!</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I will try your method in the one web directory. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Also while I was waiting for a response, I decided to start from scratch in a different web directory and rewrite my code for a database based system. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I am writing so that the system inserts into table the extension and time of call with those two grouped with a unique key to avoid duplicates. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Then have a cron check every minute to move any files with time of call datertime as current to the outgoing directory. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I have been considering two methods</div><div id="AppleMailSignature">1 - create the call file and leave in directory where Apache can write to. Then put the uniqueID of the call file into the database so when cron runs, it'll grab the file name and move that file to outgoing/</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">2- run cron and when it gets time for the call file, have the perl grab the extension and write the call file then and there and then move it to outgoing/ and deleting the database entry. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I currently going for option 2. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Is there any benefit in a database driven application or does best practices favor the original directory permissions?</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">I am not expecting a high level of wake up calls. Maybe the most of 5-10 in the system nightly. </div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Thanks,<div>--Eric</div><div><br></div><div>Sent from my phone.</div></div><div><br>On Dec 28, 2015, at 8:12 AM, Dale Noll <<a href="mailto:dnoll@wi.rr.com">dnoll@wi.rr.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div>1. The 'Total' line that is displayed with the 'ls -l' command output is NOT the total number of files, it is the total number of system blocks used by the files in the directory.<br></div><div><br></div><div>2. In order to truly understand the situation you need to understand the Linux file system permissions.,,, Every file in Linux has 3 basic permissions for 3 types of users. The basic permissions are Read, Write, eXecute. The types of users are User, Group and Other. The permission 'mode' is displayed in the 'ls -l' output in the first column. In your example of the callfile... '-rw-r--r--'. This gives the User Read and Write to the file while Group and Other have Read to the file.</div><div><br></div><div>Directories are simply special kinds of files. A directory (very short explanation) is a file that contains the names of other files and a pointer the the place on disk where each file's data is stored(blocks in Question 1). With that understanding... in order to create and delete files in a directory, you need write permission to the directory. This you may have figured out since you changed the permissions on the outgoing directory to get PHP to be able to delete the files. Now, you may not be able to get Asterisk to properly handle the files if Asterisk is not running as root.</div><div><br></div><div>There are several ways to handle this, each with pros and cons, but how I probably would do it is change the permissions on the /var/spool/asterisk/outgoing directory so that the User and Group both have write access to the directory. </div><div><br></div><div>There are two commands to do that.</div><div><br></div><div>To change the permission mode, use the chmod command as root</div><div><br></div><div>chmod u=rwx,g=rwx,o=rx /var/spool/asterisk/outgoing</div><div><br></div><div><br></div><div>To change the ownership of the directory, use the chown command as root</div><div><br></div><div>chown asterisk:apache /var/spool/asterisk/outgoing</div><div><br></div><div><br></div><div>This will allow both the 'asterisk' User and the 'apache' group to create and delete files in the directory.<br></div><div><br></div><div><br></div><div>You may also find it beneficial to change the ownership of the call file when you move them into the outgoing directory. Asterisk will modify the files as it make call attempts. Therefore the asterisk user should be able to write to the call file itself. In your script that moves the files, you may want to add a 'chown asterisk:apache {callfile pathname}'. </div><div><br></div><div>I don't know if your perl cron job does other things, but I would simply do it all using a set of bash commands.</div><div><br></div><div>chown asterisk:apache /tmp/*.call && mv /tmp/*.call /var/spool/asterisk/outgoing</div><div><br></div><div>That can be put into a shell script or run directly in a crontab entry.</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Sun, Dec 27, 2015 at 9:14 PM, er ic <span dir="ltr"><<a href="mailto:email.eherr9633@gmail.com" target="_blank">email.eherr9633@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I am hoping to get some help here with building custom PHP to manage a 'wake up call' system.<div><br></div><div>I have the script where the user can set the schedule for an extension wake up call.</div><div><br></div><div>It appears to write to the /var/spool/asterisk/outgoing/ directory.</div><div><br></div><div>My two issues:</div><div><br></div><div>1 - when the files do get moved over to outgoing/ directory via a cron job, the permissions show "-rw-r--r-- 1 apache apache 100 Jan 1 2016 5680a312a28b2.call" and the calls get sent when the date comes to pass. But my question is, if I mv 3 files from my php script, 'll /var/spool/asterisk/outgoing/' shows 'total 12' when there are only three files in the directory. What does total mean? Is my perl script doing something that I am not aware of and really there are 12 files overlapped or something funky?<br></div><div><br></div><div>--- cron job perl script</div><div><div>my @list = glob("/tmp/*.call");</div><div>for( 0 .. $#list )</div><div>{</div><div> system "mv $list[$_] /var/spool/asterisk/outgoing/";</div><div>}</div><div>-------------------------------</div></div><div><br></div><div>2 - I would like to view and delete call files but as it currently stands, php gets a permission denied.</div><div>obviously php is running as apache and the outgoing/ directory is asterisk:asterisk but the call files are apache:apache. My question is, what is the best way, without risking security, to allow php to list and delete the files? I know my scripts themselves work because when I chown apache:apache /var/spool/asterisk/outgoing the script works. I have seen front ends work with all the same permissions on outgoing/ and the files but I dont know how they are able to read/delete the files for monitor/ which is the same as the outgoing/ directory.</div><div><br></div><div>Thanks for your help in advance all!</div><div>--Eric</div><div><br></div></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" rel="noreferrer" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" rel="noreferrer" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" rel="noreferrer" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div></div>
</div></blockquote><blockquote type="cite"><div><span>-- </span><br><span>_____________________________________________________________________</span><br><span>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com">http://www.api-digital.com</a> --</span><br><span>New to Asterisk? Join us for a live introductory webinar every Thurs:</span><br><span> <a href="http://www.asterisk.org/hello">http://www.asterisk.org/hello</a></span><br><span></span><br><span>asterisk-users mailing list</span><br><span>To UNSUBSCRIBE or update options visit:</span><br><span> <a href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a></span></div></blockquote></body></html>