# Watcher Script

**URL:** <https://community.unix.com/t/watcher-script/301563>\
**Category:** UNIX for Dummies Questions & Answers\
**Created:** [December 22, 2011, 8:51am UTC](https://community.unix.com/t/watcher-script/301563 "2011-12-22T08:51:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rymnd\_12345](https://community.unix.com/letter_avatar/rymnd_12345/32/5_5575768a8748004e209b776fc1b2916d.png) [@rymnd\_12345](https://community.unix.com/u/rymnd_12345)\
**Post date:** [December 22, 2011, 8:51am UTC](https://community.unix.com/t/watcher-script/301563/1 "2011-12-22T08:51:42Z")

</div>

Hi Guys,

I hope anyone can help me on how to create a watcher-script. The script will act as watcher wherein whenever it will find an error (say the word Error) in a file, it will prompt the user.

Please help!

br,  
rymnd\_12345

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/5_5575768a8748004e209b776fc1b2916d.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [December 22, 2011, 9:39am UTC](https://community.unix.com/t/watcher-script/301563/2 "2011-12-22T09:39:40Z")

</div>

```nohighlight
grep error file > /dev/null && echo "error found in file"

```

---

<div class="post-metadata">

**Author:** ![itkamaraj](https://community.unix.com/user_avatar/community.unix.com/itkamaraj/32/1880_2.png) [@itkamaraj](https://community.unix.com/u/itkamaraj)\
**Post date:** [December 22, 2011, 9:52am UTC](https://community.unix.com/t/watcher-script/301563/3 "2011-12-22T09:52:54Z")

</div>

Hi Raymond,

Dont ask the same question again and again...

> **[How to create a script that will email once there is an error?](https://www.unix.com/unix-for-dummies-questions-and-answers/173679-how-create-script-will-email-once-there-error.html)**
>
> Hi Guys, Good day ULF! Can you assist me in creating a script that will email once an error has occurred. It's like this, I have script that is used for monitoring, distinct keywords on the status are | The UNIX and Linux Forums

```plaintext
grep "error" file >/dev/null && mail -s "Error Found" abc@xyz.com

```

---

<div class="post-metadata">

**Author:** ![rymnd\_12345](https://community.unix.com/letter_avatar/rymnd_12345/32/5_5575768a8748004e209b776fc1b2916d.png) [@rymnd\_12345](https://community.unix.com/u/rymnd_12345)\
**Post date:** [December 22, 2011, 10:07am UTC](https://community.unix.com/t/watcher-script/301563/4 "2011-12-22T10:07:56Z")

</div>

Hi Guys,

Thanks for your help!

Hi itkamaraj,

I'm sorry.

br,  
rymnd\_12345
