Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] CGI script that will SENDMAIL when file added to folder.

Expand Messages
  • guest user <docdoo99@yahoo.com>
    ... each time ... time is ... This would create exessive CPU usage on the server. Especially since there are 100 s of other files to compare against (many
    Message 1 of 8 , Jan 3, 2003
      --- In perl-beginner@yahoogroups.com, "Octavian Rasnita"
      <orasnita@h...> wrote:
      > Make a CGI script which is executed by cron or which is executed
      each time
      > someone will visit a certain web page from that site.
      > Put it to create a list of files from that directory, and each
      time is
      > executed, let it compare it with the list of the files from that
      > directory...
      -----

      This would create exessive CPU usage on the server. Especially since
      there are 100's of other files to compare against (many large). Its
      kind of like using a drill press to punch a hole in paper :) But
      your right, it can be made to work... In the past, I've only used
      cron to send me logs (error & access) every 3:am.

      There must be a cleaner (simpler) way of doing this. Maybe its time
      to re-code the whole entire thing from scratch :-O
    • Charles K. Clarkson
      ... I can think of two paths. Write a script that compares an old directory listing with a current directory listing and reports changes. Then cronjob the
      Message 2 of 8 , Jan 3, 2003
        guest user <docdoo99@...> replied:

        : This is why I thought a basic (hehe) script that
        : uses "sendmail" to email me when file is added to
        : specified directory. This way nothing effects
        : their current setup.

        I can think of two paths. Write a script that
        compares an old directory listing with a current
        directory listing and reports changes. Then
        cronjob the script (I'm assuming your using unix).
        I don't see how you'd get a user IP or the
        original file name but you would have the new
        filename.

        The second idea would be to use signal
        processing to alert a perl program that a new
        file has been uploaded. I have no idea how to do
        this. Perhaps a kind unix person from the list can
        tell us if it is possible to use signals in this
        way. This approach would be very OS specific.

        Either of these two approaches does not
        involve programming the CGI. There is no need to
        communicate with a browser to send email via
        send mail.

        (A third approach would be to rewrite the
        script you're "not allowed" to rewrite. Of
        course this depends on why you're not allowed
        to edit it. Think of it as Civil Disobedience,
        but don't lose the job over it.)



        HTH,

        Charles K. Clarkson
        --
        Head Bottle Washer,
        Clarkson Energy Homes, Inc.
        Mobile Home Specialists
        254 968-8328
      • Octavian Rasnita
        No, it s not a big job if there are only 100 files. You don t need to compare the content of the files but only their names. You just need to compare an array
        Message 3 of 8 , Jan 3, 2003
          No, it's not a big job if there are only 100 files.
          You don't need to compare the content of the files but only their names.

          You just need to compare an array with 100 file names taken from a text file
          that keeps the old file names with the current list of file names taken from
          that directory.
          But it would be much more simple just to add a few lines of code to the
          script used for uploading.


          Teddy,
          Teddy's Center: http://teddy.fcc.ro/
          Email: orasnita@...

          ----- Original Message -----
          From: <docdoo99@...>
          To: <perl-beginner@yahoogroups.com>
          Sent: Friday, January 03, 2003 4:29 PM
          Subject: Re: [PBML] CGI script that will SENDMAIL when file added to folder.


          --- In perl-beginner@yahoogroups.com, "Octavian Rasnita"
          <orasnita@h...> wrote:
          > Make a CGI script which is executed by cron or which is executed
          each time
          > someone will visit a certain web page from that site.
          > Put it to create a list of files from that directory, and each
          time is
          > executed, let it compare it with the list of the files from that
          > directory...
          -----

          This would create exessive CPU usage on the server. Especially since
          there are 100's of other files to compare against (many large). Its
          kind of like using a drill press to punch a hole in paper :) But
          your right, it can be made to work... In the past, I've only used
          cron to send me logs (error & access) every 3:am.

          There must be a cleaner (simpler) way of doing this. Maybe its time
          to re-code the whole entire thing from scratch :-O





          Unsubscribing info is here:
          http://help.yahoo.com/help/us/groups/groups-32.html

          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        • guest user <docdoo99@yahoo.com>
          ... =========== They don t want it changed because the way it stands now...it ain t broke :) But to be quite honest with you, this automated sendmail script
          Message 4 of 8 , Jan 3, 2003
            >A third approach would be to rewrite the script you're "not
            >allowed" to rewrite. Of course this depends on why you're not
            >allowed to edit it. Think of it as Civil Disobedience, but don't
            >lose the job over it.

            ===========

            They don't want it changed because the way it stands now...it ain't
            broke :)

            But to be quite honest with you, this automated "sendmail" script is
            to speed up the work that I need to do. It my gain, not theirs. I
            could sneak the code into the original, but that is not my style :-)

            my $COMMENT = 'my search continues'; # Sigh
          Your message has been successfully submitted and would be delivered to recipients shortly.