Setting up multiple directories
Posted by TedH (TedH), 26 April 2007Hi Graham, before I attempt this I thought I'd better check, because I've got feeling it could well be done the wrong way and mess things up.
I'm in the process of creating a setup script which will do the following:
1)Create a folder in the cgi-bin
- Fill that folder with 14 scripts (after processing them).
2)Create two folders in a domain's root folder:
- Folder 1 has 2 more folders and a few files in all 3.
- Folder 2 has another 18 folders with around 140 files amoungst them.
Much of the work will be copy, rename and chmod. Some will be just copying images, scripts, files and putting them into their correct folders. This should be no problem for me.
I would assume there is a time element plus checking to see if each process is finished (maybe print out a notice it's been done) and done correctly. This is the bit I am unsure of. What do I need to look for in regards to this? I don't even know what terminology to use here
There's a lot a items, so I'm trying to make the process as idiot proof as possible and all the bits will work first time.
cheers - Ted
Posted by admin (Graham Ellis), 27 April 2007Ted, the immediate and quick answer is that is you place all your actions one after another in the same script / program, they should happen in turn with each of the items you run as a separate command or by shelling out suspecnding execution of the main script until it's completed.
Now - did I read the question right, or have I answered something else instead of what you were asking?
Posted by TedH (TedH), 27 April 2007Hi Graham, figured as much.
"shelling out suspecnding execution of the main script until it's completed"
Does that mean waiting before running the resulting scripts?
I could have a result window - something like "Everything is now setup" and a link to an html page. That should give enough time 'just in case'. Does that sound good?
Posted by admin (Graham Ellis), 28 April 2007on 04/27/07 at 08:41:37, TedH wrote:
It means that the calling script waits for one operation that it has kicked off to complete before it starts the next, so you do NOT need to take any special action.
Here's a program that does a load of setups the first time you run it, then reports what it has done on subsequent runs:
And here is how it works:
With no need for any special timing or waiting!
Posted by TedH (TedH), 28 April 2007Thanks Graham.
Not having seen anything like this before, I assume this is a Perl script which runs Unix commands (which I'm not allowed to do manually on my server).
I can see it checks to see if the directory exists and makes the directory "demosubdir" if it's not there. Then the "touch" - is this creating the file rupert.bear in the directory? Or checking to see if it is there?
So I would do this for each directory needed, in sequence. Or is it better to create all the directories first, then populate them (which is what I would do if doing it manually)?
I can see I'll have to dig into some Unix terminology here, hmmmm.
Cheers - Ted
Posted by admin (Graham Ellis), 28 April 2007I don't think it's going to much matter if you create and populate the dirctories one by one, or create all the directories first then go through and populate them all. You should consider using the built in Perl commands / functions to do as much of the work as possible as it's a little more efficient - I didn't do that on my "demo" so that I had something good with which to illustrate my answer to your earlier question.
Posted by TedH (TedH), 28 April 2007Hi Graham, thanks a lot.
Yes will do.
Thanks again - Ted
This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho