2

I am having an issue with removing temporarily files I am creating under the /www directory. I have a subdir, "/www/csv", where csv formatted files are being written based on sensor data. The files are created on-demand on the YUN, placed in the /www/csv dir, with the whole process driven by a REST call and an AJAX implementation in a browser. The files are created with no problem with a Filesystem.open(path, FILE_WRITE); call. I can also use the Process calls from the bridge library to rename the file after it is full written. However, if I try to use Process calls (i.e. p.begin("rm");, etc, etc) to remove the files after use, the files are never deleted. I also tried the "mv" the files to /tmp so they would get cleaned up by the OS eventually, but that fails also. I have the rights to /www and /www/csv set to "777". I am assuming this is an access rights issue, however I am unsure what user my REST calls are running as (it would be whatever the default is for a YUN as I have created no additional users on the system).

Thanks in advance, Pete

Pete D
  • 21
  • 1
  • what user OWNS the files? If it is root, then root has to delete, even if perms are 777. Rather than sudo the rm i would chown. (p.s. 777 is NEVER the answer). – Tyson Feb 16 '15 at 02:16
  • Are you closing the files before attempting to delete them? – DaveP Feb 16 '15 at 06:43
  • @Tyson Everything runs as root under the Yun so I doubt chown would help. – DaveP Feb 16 '15 at 06:45
  • Owner is ROOT and the process runs as ROOT. Files are closed before attempting to 'rm' or 'mv' the files. I've changed the design to stream the XML directly to the calling web page vs. writing a temp file under /www and having the web page reference it as a static XML page. AT some point I'll go back to try to understand why this didn't work in the first place. To support this change I had to add call to the DOM parser since the REST call responses by default use a TEXT Mine type in the response header. Does anyone know how to define a custom Mime response header using REST calls? – Pete D Feb 16 '15 at 13:32
  • @PeteD Please post this as an answer and mark this question closed. – Avamander Aug 23 '15 at 21:29

0 Answers0