Sponsored Content
Top Forums Shell Programming and Scripting To track any modification in a specfic file Post 302433383 by pseudocoder on Tuesday 29th of June 2010 11:33:59 AM
Old 06-29-2010
Code:
#!/bin/sh

file="/path/to/file"
destdir="/dest/dir"

if [ ! -e $file ]; then
echo "file $file not present"
exit 1;
fi

l=$(stat -f %Sm $file)

while true; do
 c=$(stat -f %Sm $file 2>/dev/null)
  if [ "$l" != "$c" ]; then
   mv "$file" $destdir 2>/dev/null
  fi
 sleep 5
  if [ ! -e $file ]; then
   echo "file $file not present, waiting for $file..."
  fi
done

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

add a line to a specfic point in a file

Hello, Simple if you know how, which I don't.... I would like to add a line to file file.env file.env consists of the following : line 1-20 here .. # Begin customizations $AVARIABLE/dir1/dir2;export $AVARIABLE # End customizations eof I would like to use a shell script to... (4 Replies)
Discussion started by: d__browne
4 Replies

2. UNIX for Dummies Questions & Answers

add a line to a specfic point in a file

Hello, Simple if you know how, which I don't.... I would like to add a line to file file.env file.env consists of the following : line 1-20 here .. # Begin customizations $AVARIABLE/dir1/dir2;export $AVARIABLE # End customizations eof I would like to use a shell script to... (2 Replies)
Discussion started by: d__browne
2 Replies

3. UNIX for Dummies Questions & Answers

Possible to track FTP user last login? Last and Finger don't track them.

Like the topic says, does anyone know if it is possible to check to see when an FTP only user has logged in? Because the shell is /bin/false and they are only using FTP to access the system doing a "finger" or "last" it says they have never logged in. Is there a way to see when ftp users log in... (1 Reply)
Discussion started by: LordJezo
1 Replies

4. UNIX for Dummies Questions & Answers

How to track the modification history on file in unix

How do we track the modification history on a file in UNIX. IS there any command or any script that we could run. Many Thanks (5 Replies)
Discussion started by: RSPDaemon
5 Replies

5. UNIX for Dummies Questions & Answers

How to change the file modification time of a file on nfs mount point

Hi I am accessing a file on nfs mounted device, after completing using of the file, i am tring to restore the access time and modification times of the file. So i got the previous modified time of the file using stat() function and trying to set the date and time for the file, To set these... (6 Replies)
Discussion started by: deepthi.s
6 Replies

6. Shell Programming and Scripting

track the errors in log file

OS: SuSE Linux Enterprise Server 10 Goal: To track the errors in log file, If they exits users will be notify by email. We have a script below: SrchKey="SRVE0242I:" LogFile=/PATHtemOut.log MailTo="DN@mail.com http:// ! -f PATH/alert.last && touch PATH/alert.last egrep $SrchKey $LogFile... (3 Replies)
Discussion started by: sdhn1900
3 Replies

7. Shell Programming and Scripting

track one file and copy to another server

Hello Friends, I am new to scripting, please guide me in below problem: I want to track a file, if anyone make any changes to that file then script should copy it to another server. my whole purpose is to backup a critical file automatically when any change is done to that specific... (1 Reply)
Discussion started by: makkar4u
1 Replies

8. UNIX for Dummies Questions & Answers

Trying To Write File Contents To Specfic .csv Cell

Hi, I'm attempting to write the entire contents of a file to a specific .csv cell. So far have only a nawk one liner that will write a value into a specific .csv cell. Trying to use man page but can't seem to get any farther. Any help would be appreciated. nawk -v r=2 -v c=3 -v val=5 -F,... (7 Replies)
Discussion started by: jimmyf
7 Replies

9. UNIX for Beginners Questions & Answers

Some trace file to track timings of a process

I will initiate a process from Server1 and the flow is as follow Server1 --> Web server --> Application server --> DB Server Note all seperate unix servers. Now I need to put a trace for that process to track the timings from each server. Like the below trace should be there: ... (5 Replies)
Discussion started by: saraperu
5 Replies
METAPIXEL(1)															      METAPIXEL(1)

NAME
metapixel - generator for photomosaics SYNOPSIS
metapixel-prepare [options] [srcdir] [destdir] prepares the pictures in srcdir by creating resized images and a table file in destdir metapixel [options] [--metapixel input.jpg output.png --library destdir] creates a photomosaic output.png using input.jpg as the input image and destdir/tables.mxt as table file DESCRIPTION
This manual page documents briefly the metapixel and metapixel-prepare commands. For more information check the README file included in the distribution. metapixel is a program for generating photomosaics. It can generate classical photomosaics, in which the source image is viewed as a matrix of equally sized rectangles for each of which a matching image is substitued, as well as collage-style photomosaics, in which rectangular parts of the source image at arbitrary positions (i.e. not aligned to a matrix) are substituted by matching images. metapixel-prepare is a utility that needs to be run before metapixel can be used. It prepares your source images so that they can be used by metapixel to create the actual photomosaic. USAGE
metapixel-prepare srcdir destdir has to be run first. srcdir is the path to the directory containing the source images, e.g. ~/Pic- tures/Holidays. destdir, e.g. ~/.metapixel, is the path to the directory where you want to store the rescaled images and the tables.mxt in- dex file. This directory should be created manually before running metapixel-prepare. metapixel --metapixel input.jpg output.png --library destdir is then used to transform an image (input.jpg) into a mosaic (output.png) us- ing the source images (described by destdir/tables.mxt). OPTIONS
The options are described in the README file or by running metapixel or metapixel-prepare with the --help option. SEE ALSO
The README file is included in the Metapixel distribution. AUTHOR
This manual page was written by Chris Vanden Berghe <Chris@VandenBerghe.org> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. AUTHOR
Chris Vanden Berghe. May 5, 2004 METAPIXEL(1)
All times are GMT -4. The time now is 08:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy