[x] Welcome to LinuxSolved.com Linux help forums, here we are a community of Linux users helping each other. It is helpful to both ie. new linux users as well experienced one. We always have our experts to help you and ofcourse members help each other, so you can ask for help any time by Registering.: Click to Register

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Linux Forums - Linux Help,Advice & support community:LinuxSolved.com  |  Forum  |  Others  |  Miscellaneous  |  Topic: Shell Script
The LinuxSolved.com GNU/Linux User Communit - Forum
Welcome to LinuxCommunity You have just arrived to a friendly linux community which is helping Linux Users from Years.. You can be its part if you have not already joined it. Registration is FREE and is gateway to unlimited help and support to all your linux related needs. If you are an GNU/Linux supporter then you have come to the right place.
Pages: [1]
  Print  
Author Topic: Shell Script  (Read 869 times)
0 Members and 1 Guest are viewing this topic.
gauravbajaj
LST CareTaker
Experienced
*****
Offline Offline

Posts: 597


View Profile
« on: January 23, 2006, 09:26:32 PM »

Hi Grp...
I have a pb , may be anyone can help me...

I want  some idea ..Actually i am a writing a shell script for my Project ..

In m project there are various customers like J090 C098 etc.(These are customers code no's)

In that , each customers has log directories ...in location say /mnt/logs/custcode/optindexes
{ where custcode is replaced by codes of customers like J090 , C098 etc)

These logs are automatically running , means  

we have a soft index named indexui , whose position is like this
 its in custcode directory

#indexui->/mnt/logs/custcode/optindexes/logs-23-01-2006

In above link the indexui is automatically updated to latest log directory like logs-23-01-2006(present date directory) , but some times it happens that it is not able to update i.e not link to latest logs directory...

so for that i have to check manually wheather link is updated to latest logdir or not..
So for that i m writing a script ,which shows "link is updated" if indexui links to updated log directory and shows "error" if its not able to update

..I checks links of all customers daily for updataion ..
So plz anyone help me how to check the links ,wheather it link to latest log directory or not ,



So help me plzzz, if anyone have idea to write this type of script

Thxx
gaurav bajaj
Logged
dragoncity99
LST CareTaker
Experienced
*****
Offline Offline

Posts: 494


View Profile
« Reply #1 on: May 07, 2006, 08:49:30 AM »

The trick to see if the log whether it's up to date or not is:

1. Store current date/time in a variable

2. Use ls & awk to get the date/time:

ls -ltr /path/to/link/your-link-name | awk '{$X}'

3. Compare it.

And ur done, u get the latest.
Logged
gauravbajaj
LST CareTaker
Experienced
*****
Offline Offline

Posts: 597


View Profile
« Reply #2 on: May 08, 2006, 01:19:11 AM »

Hi Dragoncity
 
Thx for the reply

But i did it already.. using shell scripting, i haven't used awk, but did it using  cut operator

Gaurav
Logged
dragoncity99
LST CareTaker
Experienced
*****
Offline Offline

Posts: 494


View Profile
« Reply #3 on: May 08, 2006, 02:38:09 AM »

Oh ic, u can take a look at awk script bro, it's slightly more convenient when dealing with white spaces or tabs.

I used to use cut for my scripts, but later on i found that awk is much flexible. Therefore i switched to awk.

Smiley
Logged
gauravbajaj
LST CareTaker
Experienced
*****
Offline Offline

Posts: 597


View Profile
« Reply #4 on: May 08, 2006, 03:48:17 AM »

Hi Dear
But I haven't used awk much, Can u give me any good link for awk tutorials?

Thanks
Gaurav
Logged
dragoncity99
LST CareTaker
Experienced
*****
Offline Offline

Posts: 494


View Profile
« Reply #5 on: May 08, 2006, 03:51:31 AM »

Here's a quick one:
http://stud.wsi.edu.pl/~robert/awk/

and:

http://www.vectorsite.net/tsawk.html

Wink
Logged
gauravbajaj
LST CareTaker
Experienced
*****
Offline Offline

Posts: 597


View Profile
« Reply #6 on: May 08, 2006, 05:34:32 AM »

Thanks Bro
Logged
Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
   

 Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
BASH SHELL SCRIPT Linux Development & Programming nicksthegreat 1 1322 Last post April 08, 2004, 06:02:04 AM
by sudipta_cht
shell script Linux Development & Programming puneetloiya 3 1445 Last post May 10, 2004, 11:59:35 AM
by dragoncity99
How to run a shell script using service command Linux Development & Programming sridip 3 1813 Last post May 07, 2006, 09:17:10 AM
by dragoncity99
Running shell Script Linux Development & Programming shipoin_97 1 951 Last post December 14, 2005, 08:56:18 AM
by dragoncity99
run shell script immediatly u do # rpm -ivh Linux Development & Programming ganeshgore81 2 1061 Last post September 18, 2007, 07:01:41 AM
by gauravbajaj
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 01, 2008, 08:04:17 PM

Login with username, password and session length
Navigation
Recent Discussions
[November 29, 2008, 02:23:49 PM]

[November 29, 2008, 02:14:14 PM]

[November 29, 2008, 04:00:36 AM]

[November 28, 2008, 07:05:28 AM]

[November 28, 2008, 07:04:39 AM]

[November 28, 2008, 06:58:16 AM]

[November 28, 2008, 06:47:09 AM]

[November 26, 2008, 11:53:32 AM]

[November 26, 2008, 04:00:22 AM]

[November 25, 2008, 06:44:47 PM]
Members
Total Members: 6252
Latest: rash31
Stats
Total Posts: 8285
Total Topics: 2257
Online Today: 34
Online Ever: 111
(June 28, 2007, 06:47:29 AM)
Users Online
Users: 0
Guests: 13
Total: 13
Privacy Policy| Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks
Theme & TinyPortal v0.9.8 © Bloc