#!/usr/bin/perl # Change LINE 1 to point to your server's Perl5 # Variables used by all scripts: /Web_store/ws_global.setup # File Permissions: 755 -rwxr-xr-x # NOTE: Variables specific to ws_delete_files.cgi are located in the # DEFINE VARIABLES section below crontab explanation in this file. ############################################################################ # ws_delete_files.cgi # ############################################################################ # ws_delete_files.cgi is a perl script for UNIX systems which deletes .cart # and .bnr files from the /Web_store/User_carts sub-directory and .usr # files from the /Web_store/Users sub-directory as a scheduled event using # UNIX cron. # ws_delete_files.cgi is a support script distributed with WebStore FRAMES. #==========================================================================# # Copyright (c) 1996 - 2002, RDC Software # Full copyright notice can be found in the following files for the # listed license type: # Single User License: /Docs/Copyright_SingleUser.html # Server License: /Docs/Copyright_Server.html # Created: 07/12/97 Last Modified: 01/01/2002 # WebStore@cgiCentral.net http://www.cgiCentral.net # RDC Software, Route 3, Box 29B, Grapeland, TX 75844, USA # This copyright notification can not be altered or removed from this file. #==========================================================================# # crontab file entry explanation #==========================================================================# # The crontab command for ws_delete_files.cgi has been placed in the file # /Web_store/delete_files.cron # # 0 0-23/6 * * * /mnt/web/guide/ratite/Web_store/ws_delete_files.cgi # # Entry in crontab file for ws_delete_files.cgi (above). # Executes every 6 hours, first minute of the hour. # M H d m w C # # M = minute # H = hour # d = day of month # m = month 0-12 (or names) # w = day of week 0-7 (0 or 7 is Sun, or use names) # C = the command to execute # A range of numbers is allowed. # Ranges are two numbers separated by a hyphen. # Example: 8-11 for "hours" specifies execution at hours 8, 9, 10, and 11. # An * (asterisk) used in any field always stands for "first-last". # Lists are allowed. # A list is a set of numbers (or ranges) separated by commas. # Examples: "1,2,5,9" "0-4,8-12" # Step values can be used with ranges. Following a range with "/" # skips the number's value throughout the range. # Example: "0-23/2" used in the hours field specifies command execution # every other hour. # Steps are permitted after an asterisk. # Example: "*/2" used in the hours field specifies command execution # every two hours. # Names can be used for the "month" and "day of week" fields. # Use the first three letters of the day or month (case insensitive). # Ranges or lists of names are not allowed. # The "sixth" field shown as "C" above (rest of the line) specifies the # command to execute. # The day of a command's execution can be specified by two fields, # "day of month" and "day of week". If both fields are restricted, # (not equal to *), the command will execute when either field matches # the current time. # Blank lines, leading spaces, and tabs are ignored. # Lines whose first non-space character is a # (pound sign) are comments # and are ignored. # Comments are not allowed on the same line as cron commands. #==========================================================================# # cron Commands #==========================================================================# # crontab delete_files.cron # # Submit crontab. This will overwrite your current crontab. # crontab -l # # The -l option causes the current crontab to be displayed on # standard output. # crontab -r # # The -r option causes the current crontab to be removed. ############################################################################ # DEFINE VARIABLES # $script_dir is the UNIX path to the location of ws_global.setup and # ws_delete_files.cgi (this script). cron requires absolute script path. $script_dir = '/mnt/web/guide/ratite/Web_store/400CS'; # If you change the filename of the global setup file, # change: 'ws_global.setup' &require_files(__FILE__, __LINE__, $script_dir.'/'.'ws_global.setup'); # $sendmail_notice is the amount of time between e-mail notifications # to the store administrator, informing him the script is executing, the # number of files deleted since the last notification, and the number of # .cart files resident in the /User_carts sub-directory after age deletion # is completed. # Administrative e-mail messages are sent to the e-mail address assigned # to $admin_email in ws_global.setup at $script_dir/ws_global.setup. # Change the '1' to alter the amount of time between e-mail notifications. # Setting $sendmail_notice = '' disables e-mail notifications. # Example Settings: # $sendmail_notice = '.5' 12 hours # $sendmail_notice = '.75' 18 hours # $sendmail_notice = '1' 24 hours (1 day) # $sendmail_notice = '2' 48 hours (2 days) $sendmail_notice = '1'; # $email_subject used as SUBJECT of e-mail to administrator. $email_subject = 'WebStore Delete Files Notice'; # If $browser_access = 1, web browser access is allowed. Browser access will # generate an administrative e-mail message when $sendmail_notice (above) is # equal to a non-zero value. # Setting $browser_access = '' disables web browser access. # The value of $browser_access does not effect scheduled cron execution. $browser_access = '1'; # $delete_age limits the age of shopping cart files and banner files stored # in the /User_carts sub-directory and the age of user files stored in the # /Users sub-directory. # Change the '6' to alter the number of hours these files are kept in their # respective sub-directories. # $delete_age is a whole or fixed decimal value, greater than '1'. # $delete_age defaults to '6' when set to a non-zero value, less than '1'. # Example Settings: # $delete_age = '5.5' 5 1/2 hours # $delete_age = '6' 6 hours # $delete_age = '12' 12 hours # $delete_age = '18' 18 hours # $delete_age = '24' 24 hours (1 day) # $delete_age = '48' 48 hours (2 days) $delete_age = '6'; # @delete_dirs is an array listing the UNIX path to the Web_store directory. # Age deletion of .bnr, .cart, and .usr files present in the User_carts and # Users sub-directory will be performed on each WebStore UNIX path present in # @delete_dirs. # The first element of @delete_dirs, $basedir, is set in ws_global.setup. # $basedir points to the Web_store directory. # Additional UNIX paths to other WebStore applications present on the server # may be added to @delete_dirs: # # @delete_dirs = ( # # $basedir, # '/mnt/web/guide/ratite/Web_store1', # '/mnt/web/guide/ratite/Web_store2', # # ); # The sub-directory names of User_carts and Users are derived from # $cart_directory and $user_directory in ws_global.setup. @delete_dirs = ( $basedir, ); # DO NOT REMOVE - terminates @delete_dirs # End DEFINE VARIABLES ############################################################################