scandir() in automount/autofs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I configured autofs in my fedora so that when I plug any usb stick in
/dev/sda1 it automatically mounts in /mnt/auto/usb0

There is two lines where the problem arise.

$util->run_command("ls -1 /mnt/auto/usb0 | wc -l");    // it shows 13 when I
plug my usb stick.
$list = scandir("/mnt/auto/usb0 ");  // here $list is null

This script is in a php file which is running by apache.
the $util object is not actually running the command but it is inserting the
command in a queue. There is daemon who has root access processing the
queue.
It means the command in $util->run_command() is executing with root
privilege. this command mounts and get the total amount of file/folder very
nicely
But when I run the second line I see there is no file. How can I fill the
list with those file list.
It may look that the problem is regarding permission. But I don't think so.
Becasue I use the same command I mean the same 2 lines with /mnt/cdrom, and
it works very nicely

It works,
$util->run_command("ls -1 /mnt/cdrom | wc -l");    // it shows 200 in my CD
rom drive
$list = scandir("/mnt/cdrom");  // here I get full list of files/folders

Why its happening?

I want the $list to be filled. Also I need directory and file information so
that I can make another list like
array(array('Type'=>'DIR','Name'=>'music'),array('Type'=>'DIR','Name'=>'music1'),array('Type'=>'FIL','Name'=>'
elvis.mp3'),array('Type'=>'FIL','Name'=>'elvis2.mp3'),...);


-- 
shout at http://me.cmyweb.net/
comment on http://talk.cmyweb.net/
All time available for Hire/Contract/Full Time :)

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux