(*

doDaily

By: Joe Szedula

   Notes:
  1. This script runs Apple's "Daily" maintenance script normally run early in the morning.
  2. You will be prompted for your system's administrator password when running this script.
*)
on run
   set lf to ASCII character 10
   set StartUpDisk to path to startup disk as text
   set tmpCmdFile to StartUpDisk & "private:tmp:tmpDaily"
   
   set myFileRef to (open for access file tmpCmdFile with write permission)
   write "/bin/echo '' >> /private/var/log/daily.out" & lf to myFileRef
   write "/bin/date >> /private/var/log/daily.out" & lf to myFileRef
   write "/bin/echo '' >> /private/var/log/daily.out" & lf to myFileRef
   write "/bin/sh /etc/daily >> /private/var/log/daily.out" to myFileRef
   close access myFileRef
   
   set tmpCmdFile to POSIX path of tmpCmdFile as string
   
   set cmd to "/bin/sh " & tmpCmdFile
   with timeout of 1800 seconds
      do shell script cmd with administrator privileges
      
      do shell script "rm " & tmpCmdFile
      
      display dialog "Done 'Daily'" buttons {"OK"} default button "OK" giving up after 5
   end timeout
end run