2 shell scripts in Sun Solaris


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting 2 shell scripts in Sun Solaris
# 1  
Old 01-29-2009
2 shell scripts in Sun Solaris

Hi,
Can somebody pls help me? I need to write 2 shell scripts in Sun Solaris operating system which would do this:

1. go to the specified directory - I am using alias for it at the moment
2. start the particular sql script with the output log as same as the script but with timestamp e. g. .dy-m-d.log
3. when it finishes - echo "script finished successfully"

then I need to do another script little bit similar but with connection to the db:

1. go to the specified directory - I am using alias for it at the moment as well
2. start the particular sql script with output log as same as the script but with timestamp e. g. .dy-m-d-a.log
3. when it finishes with the count=0 exit
4. when it finishes with the count>0 connect to the db
5. execute command:....
6. after it finishes disconnect from the db and start the script in the step 2. but with .dy-m-d-b.log
7. after it finishes echo "count from 1st script and the second script"

I would appropriate your help as I am new to the shell scripting and still learning.

Thanks in advance
# 2  
Old 02-03-2009
Your question is too broad, and we generally don't write entire scripts from spec (unless it's just a few lines). Check out this link for a very good intro for beginners on shell scripting. It's linux based, but most of this should apply to any modern *NIX.

Last edited by Neo; 02-03-2009 at 02:07 PM.. Reason: pointed to directory
# 3  
Old 02-03-2009
for logging.... ( i sense some deja vu going here... )
my preferred idiom, subshell with redirection:

Code:
date '+%d-%m-%Y | read date_stamp

FLOG=${0##*/}.${date_stamp}

(
echo starting $0 . . . .
some commands
more commands
etc...
) > $FLOG 2>&1

echo all done with $0

# 4  
Old 02-03-2009
Just adding to what Quirky said to help you with your second part. It would be:
Code:
FLOG=${0##*/}.${date_stamp}-a.log

{ 
   do-process-part-a
} > $FLOG 2>&1

FLOG=${0##*/}.${date_stamp}-a.log
{
  do-process-part-b
} >$FLOG 2>&1

echo Finished with $0

# 5  
Old 02-04-2009
thanx guys it helped Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Sun Solaris not able to ping Sun Solaris

I have a Sun Blade 2500 with SUN 5.9 OS installed. I can ping other machines(windowsXP/2003) from my SUN machines but not able to ping each other SUN machines which i have newly installed. (7 Replies)
Discussion started by: z_haseeb
7 Replies

2. Solaris

useful links and help resources for Sun's products and Sun's Solaris

Hi all, Those links might help anyone Knowledge base Video tutorials (0 Replies)
Discussion started by: h@foorsa.biz
0 Replies

3. Solaris

Sun Fire 280R Sun Solaris CRT/Monitor requirements

I am new to Sun. I brought Sun Fire 280R to practice UNIX. What are the requirements for the monitor/CRT? Will it burn out old non-Sun CRTs? Does it need LCD monitor? Thanks. (3 Replies)
Discussion started by: bramptonmt
3 Replies

4. Shell Programming and Scripting

How to write shell script in sun solaris ?

Hi , I am New to unix shell scripting. So can anybody help me. How to write shell script in sun solaris ? How to run/execute the script ? please post in details. (1 Reply)
Discussion started by: deb.simply
1 Replies

5. Solaris

password less login from openssh to SSH Secure Shell 3.0.1 Sun solaris 7

Hi, I would like to login from a Sun server running ssh: Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090704f to ssh: SSH Secure Shell 3.0.1 on sparc-sun-solaris2.6 How can I achieve this? Thanks a million in advance (1 Reply)
Discussion started by: newbewie
1 Replies

6. UNIX for Dummies Questions & Answers

Sun Solaris 10: How do I create a bootup disc? The Sun website confuses me

Hey there, I am starting a Computer Science Foundation year at the end of this month and am trying to get a little bit ahead of the game. I have always wanted to learn Unix and am currently struggling with creating a boot disc to run Solaris (I have chosen to study this) from as opposed to... (0 Replies)
Discussion started by: Jupiter
0 Replies

7. UNIX for Advanced & Expert Users

unix shell scripts for running on solaris

am new to programmming any body suggest , how to execute, shell script interactively and like stream line edit (3 Replies)
Discussion started by: srini_ibmadmin
3 Replies

8. Solaris

escaping * in korn Shell under Sun Solaris

When trying to escape special character * - it doesn't seem to work. In korn shell trying to store a local variable as follows sample=test* echo $sample - gets all the file names starting with test* , instead i want to literally store the value test* into a variable. I tried escaping with \, with... (1 Reply)
Discussion started by: prekida
1 Replies

9. Solaris

Sun Solaris Sun Java Desktop

Ok I a n00b, not gunna hide it so here goes - Sun Solaris, V.10 i386 - during the setup, I can choose a screen resolution that looks great with 65k colors and all. However, when all is said and done 4 disks and a reboot later, I get hanious 640x480 @ 256 only. If I choose the Sun Java Desktop... (20 Replies)
Discussion started by: Spooky
20 Replies
Login or Register to Ask a Question