Wednesday, June 28, 2006

Monitoring shared folder

By default, shared folder is mounted as /mnt/hgfs/doknir/. As already noted, hgfs (acronym for VMware's Host Guest File System) is disabled in VMware Player and Server. So we need to modify our doknir Linux executable to monitor /mnt/ntfs/doknir/ or /mnt/fat/doknir/. Details follow:


  • Start Konsole
  • Enter command "sux" and root password
  • Move to folder /home/doknir/prg/
  • Source is located in file "doknir.prg"
  • Replace beginning of the function 'Main' with the following code. You can use MC (Midnight Commander) to edit file. MC in similar to popular DOS utility NC (Norton Commander).
|| *************************
|| function Main(cShareType)
|| *************************
|| * cShareType: 'hgfs' 'ntfs' 'fat'
|| local nF, aF, cF
|| local i
|| local nSec, nReal
|| local cShare, cNiz
|| local oIni
|| ? ' Doknir 0.02b3 '
|| ? '==============='
|| if PCount()=0 .or. cShareType==''
|| cShareType:='hgfs'
|| else
|| cShareType:=Lower(cShareType)
|| endif
|| cShare:='/mnt/'+ cShareType +'/doknir/'
|| ? ' '
|| ? 'shared folder: '+cShare
|| ? ' '
|| // cShare:='/mnt/hgfs/doknir/'
|| cJobPath:=cShare+'win32/jobs/'
|| cTmpPath:=cShare+'win32/tmp/'
  • Save changes and close MC
  • Enter command "./bld.sh doknir". This will use Harbour compiler to translate "doknir.prg" to "doknir.c" and then build executable "doknir". There is no ".exe" in Linux - each file has property whether it is executable or not!
VoilĂ , we have new executable '/home/doknir/prg/doknir' and there is already a shortcut on the desktop. If we want to monitor shared NTFS folder, we must add argument ntfs to the command as shown on the next picture:



[]

No comments: