03-08-2008
Perform action file name written to the pipe
Hello,
I have a script that monitors files uploaded via ftp. After a successful upload, the file name is written to the pipe.
There is another program that reads this pipe and allows automatically run any program or script ( say test.sh ) to process the newly uploaded file.
cat test.sh
#############
mail -s mail -s "New upload : $1"
test@test.tld
will email the filename to external email address.
now in test.sh I want to perform multiple functions:
1) email the uploaded file name ( which is done above )
2) grep/awk etc, for a string or word in the uploaded file and then
if
the exact word or string is found
then
do
grep -nr "$pattern" $1
echo " Following pattern found in file" $1 at line number >> /root/upload.log
/bin/rm -fr $1
else
echo "File safe: " $1 >> /root/upload.log
Now the pattern or word can be anyone of the following:
porn viagara cannibal maneater herbivore verygood millioniare donkey
so pattern is something like
pattern='porn|viagara|cannibal|maneater|herbivore|verygood|millioniare|donkey'
Please advise.
Thanks
9 More Discussions You Might Find Interesting
1. Programming
PROGRAM A <-> PROGRAM B
PROGRAM A sends data as STDIN ro PROGRAM B and when PROGRAM B is executed from PROGRAM A, it sends output back to PROGRAM A. This is implemented using 2 pipes (fd1 & fd2).
The above process happens in a loop and during the second run, the previous data that had been... (10 Replies)
Discussion started by: vvaidyan
10 Replies
2. UNIX for Advanced & Expert Users
I have the following code which works on AIX 4.3 but fails at times on AIX 5.3
with:
cat: 0652-054 cannot write to output. There is no process to read data written to a pipe.
validator="${validator_exe} ${validator_parms}"
cmd_line="${CAT} ${data_file} | ${validator}... (6 Replies)
Discussion started by: vigsgb
6 Replies
3. Shell Programming and Scripting
I have 2 files. I basically want to search both of them to see if the 1st column ($1) matches and if it matches then check to see if the 2nd column ($2) matches, then execute some code showing the results of the matches.
File 1:
AAA 123
misc blah
BBB 456
CCC 789
File 2:
... (2 Replies)
Discussion started by: streetfighter2
2 Replies
4. Shell Programming and Scripting
I don't quite know what I'm doing, so this simple script is proving a challenge.
Here is some pseudo code that doesn't work yet:
if tail -1 "WORKING.txt" >/dev/null | egrep "^NMBR=*" > /dev/null
then
curl -k 'http://www.myserver.com/log.cgi?input=$?'
echo "hi there"
fi
Purpose:... (3 Replies)
Discussion started by: dihewidd
3 Replies
5. Shell Programming and Scripting
Hi,
I have one dir which has N subdirs.For ex:
/home/user/Project_Src
/home/user/Project_Src/Dir_A
/home/user/Project_Src/Dir_A/subdir/sub_dir2
/home/user/Project_Src/Dir_A/subdir/sub_dir3
/home/user/Project_Src/Dir_B
/home/user/Project_Src/Dir_B/Build
i want to create a folder with... (2 Replies)
Discussion started by: dragon.1431
2 Replies
6. Shell Programming and Scripting
hi,
i have a service on unix platform, it will generate traces in a particular folder
i want to check using shell script if traces exist, then perform some action else continue to be in loop.
filename is service.tra
can you please help?
thanks (4 Replies)
Discussion started by: gauravah
4 Replies
7. Shell Programming and Scripting
Hi All,
I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command .
We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
Discussion started by: MAKHAN
4 Replies
8. Shell Programming and Scripting
Hello,
I'm attempting to write a tool that checks an IP address for existing PTR records then if there are no PTR records does a ping to see if it response.
Then if there is no response, it should print a message saying
This is what I have so far.
#!/usr/bin/perl
$nxdomain =... (4 Replies)
Discussion started by: spartan22
4 Replies
9. Shell Programming and Scripting
Hi,
I am new to awk/unix and am trying to put together an awk script to perform an action similar to vlookup between the two csv files.
Here are the contents of the two files:
File 1:
Date,ParentID,Number,Area,Volume,Dimensions
2014-01-01,ABC,247,83430.33,857.84,8110.76... (9 Replies)
Discussion started by: Prit Siv
9 Replies
dput(1) General Commands Manual dput(1)
NAME
dput - package upload tool for Debian
SYNTAX
dput [options] [host] package.changes ...
DESCRIPTION
This is a tool for uploading Debian packages into the archive. You may specify to which host it should upload the file by passing it an
host argument. If omitted, dput uses the host specified by default_host (or, historically default_host_non-us) configuration option. Also
you have to pass the program one or more name of package.changes files and then they will be sequentially uploaded.
This program will then upload the package for you into the archive, using a selected upload method. Currently dput supports ftp, scp,
rsync, http, https, and local. The method scripts have been split from the main script so it is easy to add new methods. Look in
/usr/share/dput/ for examples.
Should something go wrong with your upload to destinations using the Debian upload queue daemon (e.g. ftp-master), you can remove files
from the upload queue with dcut(1).
OPTIONS
-c, --config - define a config file to use.
-d, --debug - activate debugging mode, helpful if bugs occur.
-D, --dinstall - do a dry run of dinstall after the upload.
-f, --force - force an upload of an already uploaded package.
-h, --help - print help information and exit.
-H, --host-list - print the lists of hosts that dput knows about.
-l, --lintian - run lintian before the upload.
-U, --no-upload-log - do not write a .upload log file after uploading.
-o, --check-only - check only the package and do not upload.
-p, --print - print the configuration that dput is using.
-P, --passive - use passive ftp instead of active. Note that passive ftp is the default unless specified otherwise in the configuration
file.
-s, --simulate - simulate an upload only.
-u, --unchecked - don't check GnuPG signature on the changes file.
-e, --delayed - Upload to a DELAYED queue, rather than the usual Incoming. This takes an argument from 0 to 15. Note that a delay of 0 is
different from no delay at all.
-v, --version - print version information and exit.
-V, --check-version - check if the user has already installed and tested the package before putting it into the archive.
ENVIRONMENT
This program doesn't depend on any environment variables. But if the variable USER is set, it will be used.
LICENSE
This program is distributed under the terms of the GPL.
BUGS
Please send bug reports to the author.
FILES
/etc/dput.cf
global dput configuration file
~/.dput.cf
peruser dput configuration file
SEE ALSO
dput.cf(5)
dcut(1)
/usr/share/doc/dput
/usr/share/dput
AUTHOR
dput was written Christian Kurz. The current maintainer is Thomas Viehmann <tv@beamnet.de>.
Many other people have contributed to this code. See the Thanks file.
COMMENTS
The author does appreciate comments and suggestions from you.
October 5, 2001 dput(1)