Solved

Linux filesystem monitor script

Posted on 2002-05-21
2
529 Views
Last Modified: 2013-11-15
Hi,

Is there a simple script that would periodically check a directory on mapped drive for the presence of a file (we'll call it "createdir.txt")?

Thanks in advance
0
Comment
Question by:cgoldfarb
2 Comments
 
LVL 1

Accepted Solution

by:
haeger earned 400 total points
ID: 7025628
#/bin/sh

file=/somedir/somefile.txt

if [[ -e $file ]]
then
  echo "File exists."
fi

--------------------------------------------------------

Run that (and do check the syntax) with cron at your preferred intervals.

A crontab file consists of lines of six fields each.  The fields are separated by spaces or tabs.  The first five are integer patterns that specify the following:

          minute (0-59),
          hour (0-23),
          day of the month (1-31),
          month of the year (1-12),
          day of the week (0-6 with 0=Sunday).

So, crontab -e should get you into vi where you type something like

* 23 * * * * /somedir/the_above_script.sh
And your filecheck should run 23:00 each day.


.haeger
0
 

Author Comment

by:cgoldfarb
ID: 7025753
Thanks haeger.  Beautiful.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Post Clonezilla image restore issue 6 61
Looking for a program called HoneyMine. 3 60
Cannot install SkypeSetup.exe 4 34
Shrink Linux Swap File Size CentOS 10 17
If your app took Google’s lash recently, here are the 5 most likely reasons.
All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question