Need to check links exists in the server based on that need to run the build script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to check links exists in the server based on that need to run the build script
# 1  
Old 04-26-2012
Need to check links exists in the server based on that need to run the build script

Hi,
I am working on a build script which will check for the links existing in the server ,then run the gen command to start the build process.

Appreciate help on this.
server os:sun solaris 10.Bash shell

links present in the server location /spa/5.0:
Code:
genver -> sa0_genver_release
genlibs -> sa0_genlibs
scripts -> /spa/common/5.0/scripts
filetran -> /spa/common/5.0/filetran
data -> /spa/common/5.0/data

My Aim here is to automate the build script.What is does is first it will search for the links present in the /spa/5.0 directory are proper or not.For example:genver -> sa0_genver_release .This was the actual link should present in the server.
1)Script has to check whether mentioned link exists or not .if not exist ,it should throw a error mess and should create the link.(likewise for all the links)
2)Scritpt has to prompt the message like this
Do you want to create makefile or Do you want to create makefile&build
in case if user selects create makefile option then it has to run the gen -c command
if user selects create makefile&build option it has to run the gen clean all command.

I hope i have mentioned required information.Appreciate your help on this.
Advance thanks for the response.

---------- Post updated at 08:50 AM ---------- Previous update was at 04:37 AM ----------

Any help on this?

---------- Post updated 04-25-12 at 02:26 AM ---------- Previous update was 04-24-12 at 08:50 AM ----------

I have tried following command to find out the links are exist or not.
Code:
ls -lrt|grep machdefs.pl |grep ^l
lrwxrwxrwx   1 spal     spastaff      11 Apr 10 16:59 AUX_MACHINE_DEFINITION -> machdefs.pl

anyother way of checking it in solaris 10 bash shell?

---------- Post updated 04-26-12 at 02:03 AM ---------- Previous update was 04-25-12 at 02:26 AM ----------

I have tried with readlink() but now luck.it does not exit.

Appreciate any help on it?

Last edited by Franklin52; 04-25-2012 at 04:59 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 04-26-2012
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to check via SSH and credentials if file on remote server exists?

Hi there, I am sorry to ask that kind of beginner thing, but all the code I found online didnt work for me. All I want to do is: Check via SSH if a File exists on my webserver. The SSH login has to be with username and password. So I would be very thankful if somebody could write the line.... (8 Replies)
Discussion started by: Jens885544
8 Replies

2. Shell Programming and Scripting

Unable to check if file exists on remote server using expect

Hi, I need to check if a file exists on remote server using expect. #!/bin/bash ip_addr=10.10.10.10 user=root passwd=Help filename=/root/test expect -c " spawn ssh -n -T -o NumberOfPasswordPrompts=3 -o StrictHostKeyChecking=no $user@$ip_addr expect \"*?assword:*\" send --... (6 Replies)
Discussion started by: temp_user
6 Replies

3. Shell Programming and Scripting

ssh to remote server and check if file exists

Hi everyone, I am trying to figure out a way to ssh to remote server and check if file exists, and if it doesn't I want to leave the script with an exit status of 5. I have the following that I am attempting to use, but it is not returning anything: check() { ssh ${SOURCE_SERV} "ls -l... (4 Replies)
Discussion started by: jimbojames
4 Replies

4. Solaris

how to check links exists proper or not in solaris 10

Hi, I am using solaris 10 OS and Bash shell.I am looking for the command to check whether link is exits or not.if not i have to create it Requirement here is say in the server1 i have a directory /spa/5.0.in that directory there are so many links exist. Example links: genver ->... (7 Replies)
Discussion started by: muraliinfy04
7 Replies

5. Shell Programming and Scripting

Script to check file exists

Hi, I am trying to write a script which checks if any file exists with "*.log" or "*.out" in Directory below is the code #------------------ path=/abd/xyz/ if ; then echo "Good" else echo "Failure" fi #-------------------------- its always going to else part and printing... (8 Replies)
Discussion started by: ch33ry
8 Replies

6. Shell Programming and Scripting

Run script if new file exists.

Is there any way to have a script run (either on a web page or a shell script) when new files are put in a folder. E.g we have order response notification XML files uploaded to our server. They are uploaded via sftp. What i wondered if there was some way to monitor the contents and if new files... (4 Replies)
Discussion started by: timgolding
4 Replies

7. Shell Programming and Scripting

Script to check if file exists

guys, I am trying to write a script that does the following: it looks for a file in a specific directory and if the file is not there (NOT), it emails me. I have tried the following but its not working. It simply hangs up. Please help. if then mail -s 'blah blah blah' my email... (4 Replies)
Discussion started by: basisvasis
4 Replies

8. Shell Programming and Scripting

Shell script to check if any file exists in 4 folders

Hi All, working on AIX 5.3. Requirement is: Shell script in ksh to check if any file exists in 4 folders as below: 1. /FILE/INB/INT1 2. /FILE/INB/INT2 3. /FILE/INB/INT3 4. /FILE/INB/INT4 Thanks a lot for your time! a1_win. (3 Replies)
Discussion started by: a1_win
3 Replies

9. Shell Programming and Scripting

HOW TO CHECK ONLY .C FILES EXISTS OR NOT IN A FOLDER using IF in C shell script?

Hi friends.. I hav a problem.... I dont know how to check .c files exists r not in a folder using IF in C shell script actually i tried like this if(=~ *.c) even though some .c files or there in the current folder..it is not entering int o the if control statement...... (17 Replies)
Discussion started by: p.hemadrireddy
17 Replies

10. SCO

Need Script to check whether user exists in the remote machine

Hi All, I am new to shell scripting. Can someone let me know, how to check whether the user exists in the remote system? I am building a new unix box and before I proceed installing the appliation , I want to check whether the required users are created in the system . how to do this ?... (1 Reply)
Discussion started by: Srini75
1 Replies
Login or Register to Ask a Question