# To create a configurable file

**URL:** <https://community.unix.com/t/to-create-a-configurable-file/387007>\
**Category:** Homework & Coursework Questions\
**Created:** [June 15, 2022, 5:15am UTC](https://community.unix.com/t/to-create-a-configurable-file/387007 "2022-06-15T05:15:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blaze80](https://community.unix.com/letter_avatar/blaze80/32/5_5575768a8748004e209b776fc1b2916d.png) [@blaze80](https://community.unix.com/u/blaze80)\
**Post date:** [June 15, 2022, 5:15am UTC](https://community.unix.com/t/to-create-a-configurable-file/387007/1 "2022-06-15T05:15:25Z")

</div>

i am new to scripting and i had to create a shell script which has configurable path, log file name and search string and after every 5 min it should send an email if any alerts(in this case if we find the search string) but it should also search only last 6 mins log only after every 5 mins

---

<div class="post-metadata">

**Author:** ![Neo](https://community.unix.com/user_avatar/community.unix.com/neo/32/22838_2.png) [@Neo](https://community.unix.com/u/Neo)\
**Post date:** [June 15, 2022, 7:08am UTC](https://community.unix.com/t/to-create-a-configurable-file/387007/2 "2022-06-15T07:08:02Z")

</div>

> [@blaze80](#):
>
> configurable path, log file name

This is often accomplished by using environmental vars, or reading a config file.

> [@blaze80](#):
>
> and search string

This would generally be accomplished as an argument to the script you are developing.

> [@blaze80](#):
>
> after every 5 min it

This is generally done using `cron' and the `crontab` file.

> [@blaze80](#):
>
> send an email

This can be easily done using one of the many mail tools available, depending on your system and OS.

> [@blaze80](#):
>
> it should also search only last 6 mins log only

This is accomplished by filtering the log file before you search for the string, removing all the entries older than your date range. How to do this is based on the format if your log file and how it timestamps the log entries.

If you are "new to scripting" then I suggest this task looks like it is undeclared homework.

Homework must be declared as homework / school-related work when you first post it. Did you read the rules?

---

<div class="post-metadata">

**Author:** ![blaze80](https://community.unix.com/letter_avatar/blaze80/32/5_5575768a8748004e209b776fc1b2916d.png) [@blaze80](https://community.unix.com/u/blaze80)\
**Post date:** [June 15, 2022, 7:10am UTC](https://community.unix.com/t/to-create-a-configurable-file/387007/3 "2022-06-15T07:10:36Z")

</div>

this is work related task not homework

---

<div class="post-metadata">

**Author:** ![Neo](https://community.unix.com/user_avatar/community.unix.com/neo/32/22838_2.png) [@Neo](https://community.unix.com/u/Neo)\
**Post date:** [June 15, 2022, 12:01pm UTC](https://community.unix.com/t/to-create-a-configurable-file/387007/5 "2022-06-15T12:01:18Z")

</div>

Continued here:

> [@To monitor files in directory which are older than 5 mins](https://community.unix.com/t/to-monitor-files-in-directory-which-are-older-than-5-mins/387010):
>
> -homework: Every five minutes Monitor incoming directory - send an alert if there is any file present in incoming directory older than 5 minutes with outputof pwd and ls -lrt. Every five minutes monitor Failed and Processing directory - send an alert if there is any file present in processed or Failed directory with output of pwd and ls -lrt -here iam having issue that even when there is no file present the count coming is 1 and if there is file present it is coming 0 -code which i tried: …
