command in Script one to start script2


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting command in Script one to start script2
# 1  
Old 04-30-2006
command in Script one to start script2

Hello,
Hardly registered and already I am asking another question! Smilie
Following script gets started everyday with a cronjob:
Code:
#!/bin/ksh

#Variablen für das Script
Tag=`date +%d`
Monat=`date +%m`
Vortag=$((Tag-1))
Loeschtag=$((Tag-8))
Dir=/prj/sr_tmp/tpr

#Verzeichniss wechseln damit script von wo auch immer ausgefuert werden kann
cd $Dir

#Dir erstellen, Zippen und die gezippten files in das neue Dir moven
mkdir $Dir/"$Vortag""$Monat"
gzip *_"$Vortag"_*.tpr
mv *.gz $Dir/"$Vortag""$Monat"

#Aeltestes Directory löschen
rm -rf "$Loeschtag"*

#Temporaerer Code fuer Michi und David fuer Inv dateien
TprDave=$Dir/tprdave
mkdir $TprDave/"$Vortag""$Monat"
cp $Dir/"$Vortag""$Monat"/inv* $TprDave/"$Vortag""$Monat"

#Temp Datei erstellen fuer Status report
touch $Dir/tmp.txt
if [ $? -eq 0 ] ; then
echo "Script erfolgreich Ausgefuert" > $Dir/status.txt
else
echo "Script nicht erfolgreich Ausgefuert!  Bitte $tp pruefen." > status.txt
fi
#End of Script

After this script runs through i need to start this script:

Code:
#!/bin/ksh

recipient=`more $tp/email.txt`

echo "*************************************" > mailbody.txt
echo `date` >> mailbody.txt
echo "*************************************" >> mailbody.txt
echo >> mailbody.txt

echo "*************************************" >> mailbody.txt
echo "Tracefile status" >> mailbody.txt
echo "*************************************" >> mailbody.txt

echo `more $tp/status.txt` >> mailbody.txt
echo >> mailbody.txt

echo "*************************************" >> mailbody.txt
echo "Plattenfuellstand" >> mailbody.txt
echo "*************************************" >> mailbody.txt

df -k >> mailbody.txt
echo >> mailbody.txt

echo "*************************************" >> mailbody.txt
echo "Fehlermeldungen" >> mailbody.txt
echo "*************************************" >> mailbody.txt

dia -R >> mailbody.txt
echo "EOF" >> mailbody.txt

mailx -s "Pikettdaten" $recipient < mailbody.txt

rm -f mailbody.txt

I read a bunch of stuff here how to do things with cronjobs but since I am relativly new to scripting here and always learning I could not figure out how to make my scripts work consecutivly.

So once again I would be happy for any help.
And just on the something on the side: I know from vba that there are proper and improper ways to code. Although both might work one is better than the other. How is the coding here?

Thnx and KR
David
# 2  
Old 05-01-2006
As long as script 2 has it's executable flag set then simply placing the path of the script at the end of script 1 should call it.

#!/bin/sh
echo "This is script 1"
/usr/local/bin/script2
exit 0


#!/bin/sh
echo "This is script 2"
echo "I live at /usr/local/bin/script2"
exit 0
# 3  
Old 05-01-2006
Thanks
for your answer but as I found out now that we have a new month I need to solve another problem before I can call the the other script.

So thanks again!

KR
David
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to start gui from Solaris command line?

Hi. I'm a Solaris newbie. I'm using Solaris SunOS Version 11.4.0.15.0 through Oracle VM VirtualBox Manager on Windows. When I start the VM, I get to a command line I can login to. I've tried using: /usr/dt/bin/dtconfig -e However, I receive error "No such file or directory". The... (3 Replies)
Discussion started by: SRD
3 Replies

2. Red Hat

No reponse to 'service NFS start' command

Hello, I have a newly kickstarted RHEL 6.4 server that I'm trying to set-up as a kickstart server. I have done this before on other machines, but I am encountering some strange behaviour in this one. # service nfs status rpc.svcgssd is stopped rpc.mountd is stopped nfsd is stopped... (0 Replies)
Discussion started by: Chopstyx
0 Replies

3. AIX

AIX command to start listener

HI All, Need help on comamnd to start listener TIA. (4 Replies)
Discussion started by: sumanthupar
4 Replies

4. Shell Programming and Scripting

Require single command to start script in multiple servers

I have 9 servers, on each server a script with common name is available. I send a token file to all server from 1 particular server. so when a daemon job checks that token file is available then it triggers the script.. I want to know is there any command or script which I will run/execute on... (16 Replies)
Discussion started by: mirwasim
16 Replies

5. OS X (Apple)

Can I erase and start my mac with unix command

I made a tragic error and erased the extensions manager from my IMac. Now, I can't get the computer to boot up. It just stays on the gray screen. I've tried using the open apple+s method, which brings up the command console (not sure if I've got the lingo down right), and I've tried everything, but... (12 Replies)
Discussion started by: ccff22290
12 Replies

6. OS X (Apple)

How to start a new terminal from command line?

Dear All, Anyone knows how to start a new bash terminal from command line? Another question: when I use "open" command (open test.pdf) to open a pdf file, the PDF reader will start up, but cannot associate with that file. Anyone knows why? (1 Reply)
Discussion started by: andrewust
1 Replies

7. UNIX for Dummies Questions & Answers

Unix command for a dummy... where do i start?

I have never used Unix before and only heard of it at the start of the week. But ny new job requires me to use the Unix/Linux command, and i need an introduction for a total beginer... are there any intro videos or books you would recomend? :confused: (2 Replies)
Discussion started by: tomvcarter
2 Replies

8. Web Development

Http -k start Command Not found

I have Apache server installed as a package on my fedora 9 .. when i go to /etc and type the command httpd -k start It says command not found....Can anyone please tell so that i can run that command and start the server ---------- Post updated at 12:03 PM ---------- Previous update... (1 Reply)
Discussion started by: bssandeshbs
1 Replies

9. Shell Programming and Scripting

how to start SCRIPT command at begin of TERMINAL?

Hello sir, I want to monitor my work on the terminal.I know we can use script command.But every time when I start the terminal, I have to type script to start it.I want to automate it. So where should I include this command so that it will start as soon as I start the terminal ???? (2 Replies)
Discussion started by: nsharath
2 Replies

10. UNIX for Advanced & Expert Users

What is the command to start the cdrom

Hello people, What is the command to start the cdrom from the command prompt on solaris 9? plz help. rs (5 Replies)
Discussion started by: rsh
5 Replies
Login or Register to Ask a Question