Computing.Net > Forums > Unix > Unix Script

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Unix Script

Reply to Message Icon

Original Message
Name: berantima
Date: November 5, 2003 at 06:03:53 Pacific
Subject: Unix Script
OS: AIX 4.3.3
CPU/Ram: 375mhz, 1GB memory
Comment:

I would like to write a Unix script to do the following:
1. Check if a filesystem is mounted, if the
file system is mounted on this system,
execute a script tha would be passed as
a second parameter in the script.

For example:

if /tsmmsc is mounted
execute <script_name>
else
exit.

I would be setting this script up in crontab as follows:

00 23 * * * /home/user/schedjob (filesystem to be checked) (script to be executed)

example:
00 23 * * * /home/user/schedjob '/tsmmsc' '/tsmmsc/server/script/cappln.scr -sdlnfr'

Can anyone provide assistance and how to write this script?

Are you able to schedule crontab jobs and pass parameters for the script execution as outlined in the example provided.

Regards,
Tim


Report Offensive Message For Removal


Response Number 1
Name: Shaun
Date: November 7, 2003 at 17:16:28 Pacific
Reply: (edit)

I think the 'find' command will help - something like the construct...

find <mountpoint> -type d -fstype nfs -name "$1"

$1 would be your directory name passed in as the first parameter

You may be able to add -exec to execute a command.

No UNIX server here so cannot expand on this.

Hope this is of some help.


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software