Hello,
Hardly registered and already I am asking another question!
Following script gets started everyday with a cronjob:
#!/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:
#!/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