keepup3.0/ 40755 0 0 0 6170274632 10561 5ustar rootrootkeepup3.0/keepup.pl100755 0 0 2606 6170270516 12510 0ustar rootroot#!/usr/local/bin/perl # # FTP Keepup 3.0 (c) 1994,1995,1996 Chris Church / aD! Data Systems # - psylark@aD.org # # usage : keepup.pl # see README for information on setting up # #------------------------------------------ ############################################################### # $FF = file name of the ftp welcome message # $LAST = location of the last program # $user = user to check for (if other than anonymous ftp login) # $char = character set used to check for and replace w/ # the number of logins # $TF = temp file, no need to edit # $SF = store file, the template for your welcome.msg ############################################################### $FF = '/home/ftp/welcome.msg'; $LAST = '/usr/bin/last'; $user = 'ftp'; $char = '%%s'; $TF = "/tmp/.keep.$$"; $SF = '/usr/local/etc/keepup.store'; ######## do not edit past here ######## sub readlogins { $cnt = 0; open(LAST, "$LAST $user |") || die("Could Not Run $LAST -> $!\n"); while() { $cnt++; } } sub writefile { open(SF) || die("Unable to open $RF -> $!\n"); open(TF, "> $TF") || die("Unable to open $TF -> $!\n"); while() { $line = $_; eval "\$line =~ s/$char/$cnt/e;"; print TF $line; } system("/bin/mv $TF $FF"); } &readlogins; &writefile; print("FTP Keepup 3.0 (c) 1994,1995,1996 Chris Church / aD! Data Systems\n"); print("Finished: $cnt logins\nUpdated $FF, read from $SF\n") ######## end ##########keepup3.0/README100644 0 0 3374 6170274626 11550 0ustar rootrootFTP Keepup 3.0 (c) 1994,1995,1996 Chris Church / aD! Data Systems - psylark@aD.org Standard Disclaimer: The author does not guarantee in any way that this program will do anything other than take up hard drive space, if it dies or garbles, mangles, destroys or in any other way damages the data on your computer, it's your fault for having ran it... Enough of this.. I lost all my old shell scripts for FTP Keepup (you know, that bogged down nasty, slow code.. =) so I decided to re-write it in perl. Here it is, a (reasonably) faster version, alot smaller but alot less user-friendly. (why would it need to be ? It only does one thing.) Here's how it works, it replaces a string (%%s by default) with the number of FTP logins (or other user as you may define) as reported by last(1). Example: Here's an example welcome.msg, with the default token thrown in: Welcome to some.site's ftp site! Total FTP logins : %%s (updated every 15 minutes) Here it is after the replacement: Welcome to some.site's ftp site! Total FTP logins : 235 (updated every 15 minutes) Pretty simple... Setting Up: To install / setup the FTP Keepup 3.0, you'll need to do a few things first, first, copy keepup.pl /usr/local/sbin, then copy your FTP welcome file to /usr/local/etc/keepup.store (or some other file as defined inside the keepup.pl [see $SF]) then, edit the /usr/local/etc/keepup.store and place the token string wherever you want it (it may be anywhere). You'll then want to make sure the path to the welcome file [$FF] is correct inside the script. Then, you may run it manually, or have it run from crontab w/ the following line: 15,30,45,60 * * * * /usr/local/sbin/keepup.pl this will run it every 15 minutes. That's it, you're set. Chris Church psylark@aD.org