Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Feb 22, 2013 8:28 pm 
Offline
Senior Newbie

Joined: Tue Jan 08, 2013 1:52 pm
Posts: 13
So any time I set up a Wordpress site for a client on my linode server (Ubuntu 12.04) I run these commands, one-by-one, via the command line. It doesn't take long, but its tedious.

I'd like to know how to create a script that I can execute from the command line that would encapsulate all these individual commands. It should:

1. Be able to accept a number of parameters (e.g. siteurl, dbname, etc...)

2. I need to be able to use those paramters as variables in the script (e.g. mkdir /srv/www/{siteurl}/public_html)

3. Where should such scripts be located? What permissions should I set on them? What are the naming conventions?


I imagine its fairly trivial to put something like this together, I just want to make sure I do it right and following whatever conventions there are for these kind of things.


Top
   
PostPosted: Fri Feb 22, 2013 9:36 pm 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
3. probably /usr/local/bin owned by root, mod 755. pick a name that doesn't conflict with an existing name. also make it wordy so it won't likely conflict in the future.
say addwordpresssite, then you would need to type addw[tab] blah

the rest you'll need to find a scripting tut, it's a lot of fun.


Top
   
PostPosted: Sat Feb 23, 2013 1:58 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
Chapters 34 and 35 of the FLOSS Manuals intro to the command line (1.7MB PDF) may be enough to get you going. For more detail, the Advanced Bash Scripting Guide is pretty good. You'll be handling command line arguments using positional parameters. chesty's recommendations are sound.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group