What is the best practice?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What is the best practice?
# 1  
Old 12-04-2008
What is the best practice?

I'm playing the shell game of moving and deleting files to make room for current DB backup. A set of files gets moved to serverB when serverA threshold is exceeded. I created two scripts one for serverA and one for serverB. Both scripts are run by cron entry. There is a difference of 12 minutes between the servers. I'm trying to get that question answer from the senior admin as to why the time difference. ServerA will fire at a predetermine time "sleep xxx" to allow serverB read a file sent from serverA. The file is capacity of filesystem u06. If file exceeds threshold delete files on serverB.

My question is there a better way to run the scripts due to time difference? My thought is to invoke serverB script from serverA script. How can I fire off serverB script from serverA script?
# 2  
Old 12-04-2008
You may try something like this:
Code:
#!/bin/sh

# Your code here

#Here you start the script
ssh $SERVER_NAME script_b.sh

#This should also do the job:
ssh $SERVER_NAME <<EOF
  script_b.sh
  exit
EOF

#And then rm what you want to rm

This way you will start script B immediately after script_a and when script_b is finished you can delete your files (from script_a).
# 3  
Old 12-04-2008
If I understand you correctly, create another script to run both scripts. That's way too cool! This has been a great week learning new things with scripting. Thanks.
# 4  
Old 12-04-2008
Actually my point was to call script_b from script_a. And the code up there was meant for script_a. But of course there is no problem to create new script to call both of them.
# 5  
Old 12-04-2008
Gottcha! The light bulb turned on after I sent the post. After several hours of testing (due to VPN issues) I got it to work. Thanks again.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

LVM PE. Best practice

Hi everyone. Unfortunately I can't find advice's about LVM Physical Extent for HPUX. As far as I know we can set for 1PE size from 1MB to 256 MB. But in what cases it should be different? Maybe exist any strict rules, requirements or any best practice? (2 Replies)
Discussion started by: jess_t03
2 Replies

2. AIX

AIX practice

Dears, Kindly as preparing to get AIX certification I'd like to have your guide & support where can I find dump or exam forms for below :- Test 000-103: AIX 6.1 Basic Operations Test 000-221: AIX 7 Administration I want to look at real questions and try to solve it , is it possible to... (1 Reply)
Discussion started by: arm
1 Replies

3. UNIX for Dummies Questions & Answers

practice scripting

Is there any sites out there that have examples of things they want you to go and script for practice? I have looked around but have came up empty handed. I have been writing scripts for things I need on my nix box but have am wanting more challenging things to keep me learning. I would prefer... (3 Replies)
Discussion started by: linuxn00b
3 Replies

4. UNIX for Dummies Questions & Answers

hp ux practice

hi i am new in unix.i have installed linux in my pc,but i want to practice and be expatise in hp ux.but i have no hp server for do it.how could i practice hp ux?please help and give suggestion. (1 Reply)
Discussion started by: dipanjan123
1 Replies

5. Programming

how to practice my c++ skill

Hi all, I'v already read some basic books about c++ such as <c++ primer>,<The C++ standard library> etc.,and as we know,knowledge is easy to forget without practicing,so i wanna know some ways to practice my skill with programming.First,i know some ACM sites,however,solving problems on those sites... (4 Replies)
Discussion started by: homeboy
4 Replies

6. Shell Programming and Scripting

Best practice for bracket comparisons?

So, I have no formal higher education in programming at all and am self taught. I am now wondering what would be considered best practices? Like should I hard code a variable, then compare it to what I want to know or achieve, or should I just put the commands with in the brackets? Example, a... (5 Replies)
Discussion started by: tlarkin
5 Replies

7. UNIX for Dummies Questions & Answers

Newbie Wants Hardware For Practice?

I want a cheap dedicated machine to install a flavour of unix on and try to learn this OS. I know nothing about unix, just gone out and bought some books etc. Should I just get the cheapest old laptop off Ebay to install it on? What type of unix OS should I install?...a version of... (5 Replies)
Discussion started by: IBMPBC
5 Replies

8. Cybersecurity

best practice for logging options

Hi We just had an auditor tell us to formally review our logging parameters on the server and implement best practice for logging, based on a risk assessment. Phew! Before my time here, there was no reasoning behind what we chose to log or not log. Any ideas where such a "best practice"... (1 Reply)
Discussion started by: theonewhowas
1 Replies

9. Shell Programming and Scripting

best practice please

I have a data file that I tail and dump the data into a new file at midnight. To work I had to use tail -n2 livefile.csv >> storefile.csv. This is ging me 2 or 3 entries at a time into the storefile.csv. if I continue this then I will have to run a second pass on the file to remove the... (4 Replies)
Discussion started by: Mikey
4 Replies

10. UNIX for Dummies Questions & Answers

Samba Practice

I have a dual boot machine with both "Windoze ME" and Redhat Linux 7.2. I want to know if it is possible to practice with the Samba Suite on a dual boot machine if I was able to incorporate using IP addresses. I was thinking if your able to ping yourself why wouldn't you be able to administer... (3 Replies)
Discussion started by: bilal_aa
3 Replies
Login or Register to Ask a Question