Solved

Linux filesystem monitor script

Posted on 2002-05-21
2
531 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Let’s list some of the technologies that enable smooth teleworking. 
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 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