The following script might help with your issues, but it is making LOTS of assumptions since you haven't answered many of my questions. If any of my assumptions are wrong, this script won't work. My assumptions include, but might not be limited to:
Your flashdrive is mounted on the mount point /var/media/ftp.
A primary goal of this modification to your script (whether it sits on your flashdrive, in your $HOME/bin directory, or in some other directory that you implicitly or explicitly specify the you run this script) is to reduce accesses to your flashdrive. After the initial start-up, this script accesses your flashdrive once per hour if your blacklist (alertlist.txt) does not change during the preceding hour or four times if the blacklist does change during that hour. Accesses to files off of the flashdrive are less efficient than they might otherwise be because the primary goal of these changes to your script is to reduce accesses to the flashdrive.
The interpreter used to run your script is not a traditional Bourne shell. The following script was written and tested using a Korn shell, but should work with any mostly POSIX-conforming shell (such as bash, dash, ksh, or zsh). It will NOT work with any csh derivative and will NOT work with a traditional Bourne shell.
The script /var/media/ftp/look.sh can be moved off of the flashdrive into a different directory and run from that alternative location without referencing any other files on the flashdrive.
This script looks for blacklisted nearby WiFi users and then sleeps for 4 seconds; it does not make any attempt to run every four seconds. (If it takes one second to run the code in the loop, this means the loop will be run about twelve times per minute instead of fifteen times per minute. I doubt that it will take one second to run one iteration of the loop, but the type of hardware you'r using, the amount of available memory you have, scheduling delays, system load, networking delays in delivering e-mail, etc. clearly may introduce delays that will keep this script from running 15 times per minute.)
The only way to stop this script is to kill it (and if kill -9 is used to stop it, it will not be able to remove the temporary work areas it uses). It would be a good idea to add a stop file that the script can examine every time it goes through the loop and if that stop file is found, it will stop and exit normally.
There is no attempt to keep multiple invocations of this script from running simultaneously. If that is a problem in your environment, add code to keep another invocation from running if the script is already running.
Additional checks will be added to verify that commands run inside the loop complete successfully. This script is provided for demonstration purposes and is not suitable for use as production code.
You will change the e-mail address shown in red in this script to be one or more valid e-mail addresses o people who want to receive the output produced by this script.
These 2 Users Gave Thanks to Don Cragun For This Post:
I need to code a script, which will run via cron, every 30 minutes.
The script will read a file containing a date&time and number (which represents disk space). The file gets appended to every 30 minutes. Here's a sample of the file:
CPU 1:04/25/02 1:00 am:1972554
CPU 1:04/25/02 1:30... (1 Reply)
I am trying to write a client server chat program in C and am unsure as to how I would broadcast all the users IDs over the network. At the moment I have the usernames stored in a array clientsock.cl_id, I am able to output this information to the server but am unsure how to transmit this... (1 Reply)
Hi All,
We plan to use squid has a proxy so my question is if I use squid then is this support email clients like outlook express or microsoft outlook at client side and is any option in the squid to block few of the unwanted URL's
Thanks,
Bachegowda (7 Replies)
Hello,
I want a script that will scan the file /etc/httpd/conf/httpd.conf and the folder /etc/httpd/libexec/
-bash-2.05b# grep mod_r /etc/httpd/conf/httpd.conf
LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_rewrite.c
-bash-2.05b#
-bash-2.05b# find... (4 Replies)
hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version).
i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010).
a. i cant see a list of the contacts,... (0 Replies)
This is my first time writing a script and Im having some trouble,
Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage
I tried grep
Obviosly that hasnt worked,
Any... (8 Replies)
Hi There
I have to wrote a script where I am able to echo a result of an SQL script, however I want to be able to send an email to myself when it is more than 0 (so whenever a value is returned) is this possible?
I tried one way from looking on the web but this didn't work, I have added my... (8 Replies)
I am running the gaussian program on UNIX with bash and I want to form a script that will email me once the output life terminates either "normal termination" or "false" I just started learning this last week so could you let me know how to go about this.:b: (13 Replies)