473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Script

I want to have a script which will do the following tasks for 7 different servers.

1)Mount the NAS drive.
2)Create a directory for each server
3)Copy /home for each server in their respective directories
4)Unmount the NAS drive
5)Logging the entire operation.

I am not understanding from where will this script run?

Please Help!!
:)
May 3 '07 #1
1 1568
prn
254 Expert 100+
I'm going to make some assumptions here and you can let me (us) know which of them are OK and which may run into problems.

First, these are all Unix/Linux servers, right? And you are the admin with root access for all of them? If we don't meet these initial criteria, the problem gets a lot more complicated fast. I am also going to assume that the job needs to run unattended, e.g., in the middle of the night from a cron job.

I am not understanding from where will this script run?
As usual, the correct answer is "It depends." Do you need it to run from a single master location or can you just fire it off on all 7 of your servers independently? The answer to this question may depend on the quality of your internal network and the capacity of your NAS. If you have no worries about your network and have enough physical spindles on your NAS, then you might even be able to run the same transfers on all of the seven servers at the same time. OTOH, if you have just one large physical drive on your NAS, then you will want to run the jobs sequentially rather than simultaneously. I cannot answer those questions for you.

The simplest case is where you don't really need to worry about collisions and you can just run the jobs independently on all seven of your servers. You could choose to run them all at the same time or, at least as likely, stagger the starting times to reduce the demands on the NAS. If you can just drop the same script onto all of the servers, possibly with some minimal configuration changes, and then put an entry into each server's crontab, the problem becomes nearly trivial.

However, if you need to make sure that each one is finished before the next one starts, then you need to set up some kind of signalling. As usual, "there is more than one way to do it." (the Perl motto) About the simplest way I can think of to set this up (off the top of my head) might be to create an account on each machine with minimal privs and basically no other access to anything where the previous server can drop a message that it is done.

Here's an example. Suppose the first server ServerOne starts off at 6pm and you expect it to take about an hour. Note that I'm not saying that you are going to guarantee that it will be done in an hour. I'm just picking something reasonable as a starting point. In that case, the root crontab on ServerTwo might point to a script something like this (very high-level pseudocode) which is set to start at, say, 6:45, or shortly before you expect ServerOne to finish:

Expand|Select|Wrap|Line Numbers
  1. BEGIN
  2. open log file
  3. LOOP until you can find the file /home/dummy/ServerOne.isdone 
  4. ...(sleep between checks)
  5. mount NAS drive
  6. copy (or better rsync) /home to NAS
  7. unmount NAS drive
  8. log in to dummy@ServerThree and write file: /home/dummy/ServerTwo.isdone
  9. rm /home/dummy/ServerOne.isdone locally 
  10. ...(so it won't be there too soon tomorrow)
  11. close log file
  12. END
  13.  
Obviously ServerThree through ServerSeven (and, for that matter, ServerOne) will have essentially the same script, just starting at different times.

This, of course, depends on the assumption that it is ok to log the operations locally for each server. If you want to log all of them in a single location, there are still a number of ways to handle it, including NFS mounting a single location to all of them or scp'ing all the logs to a single location or ...

Do look up rsync, by the way. This looks more or less like a backup scheme and rsync would be a much less intensive way to backup your /home filesystems than cp.

There are reasons I could think of why this scheme might not work for some situation, but when it comes to setting it up, this is probably about as simple as you can get. In order for one system to log in to another, look up ssh. DON'T use rsh! (unless your circumstances are right for it and if you don't know, then they are almost certainly not right to use rsh.)

Clearly I've left out lots of details, but I hope that this has given you enough of an idea to get you going.

Best Regards,
Paul
May 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
1
by: bayouprophet | last post by:
Cant get menu script to to put linked page in the same frame. I am new to Java and I am wondering what am I doing wrong? below are my java applet file, frame.html file, and my text file and one...
1
by: Allen | last post by:
I am trying to add an additional photo/hyperlink to the company web site (I didn't create it) without any luck. The mouseover feature 'highlights' pics by swapping them with another pic using this...
3
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None...
2
by: bilaribilari | last post by:
Hi all, I am using Tidy (C) for parsing html pages. I encountered a page that has some script as follows: <script> .... var abc = "<script>some stuff here</" + "script>"; .... </script>
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
by: rsteph | last post by:
I have a script that shows the time and date. It's been working on my site for quite a while now. Suddenly it stops showing up, after getting my drop down menu to work. If I put text between the...
3
by: Angus | last post by:
I have a web page with a toolbar containing a Save button. The Save button can change contextually to be a Search button in some cases. Hence the button name searchsavechanges. The snippet of...
7
by: imtmub | last post by:
I have a page, Head tag Contains many Scripts and style sheet for Menu and Page. This code working fine and displaying menus and page as i wanted. Check this page for reference....
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.