LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-24-2020, 05:38 PM   #1
LYC
Member
 
Registered: Jan 2014
Posts: 109

Rep: Reputation: Disabled
scripting queries


Hi,

We have 3-tier applications installed in different servers: apps server, web server and DB server in our environment. The backup will start backup when apps, web and DB are shutdown in sequence. The applications will need to startup after the backup completed.

As the applications are installed in different servers, how to write a script to coordinate to shutdown and startup for the backup?

Thanks in advance.
 
Old 08-24-2020, 05:46 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,907
Blog Entries: 13

Rep: Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041Reputation: 4041
Quote:
Originally Posted by LYC View Post
Hi,

We have 3-tier applications installed in different servers: apps server, web server and DB server in our environment. The backup will start backup when apps, web and DB are shutdown in sequence. The applications will need to startup after the backup completed.

As the applications are installed in different servers, how to write a script to coordinate to shutdown and startup for the backup?

Thanks in advance.
See my signature for my bash blog, it has some tips for bash scripting, and also references for bash scripting, such as the introduction manual, and etc.

Were you planning to use a bash script?

Have you ever written any scripts?

"Whatever you can type into the command line, you can use in a script."
 
1 members found this post helpful.
Old 08-24-2020, 05:53 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 23,112

Rep: Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451Reputation: 6451
Quote:
Originally Posted by LYC View Post
Hi,
We have 3-tier applications installed in different servers: apps server, web server and DB server in our environment. The backup will start backup when apps, web and DB are shutdown in sequence. The applications will need to startup after the backup completed.

As the applications are installed in different servers, how to write a script to coordinate to shutdown and startup for the backup?
You've been asking about/writing scripts for at least five years now...surely you have SOME idea on what you need to do??

And unless you provide any details about what you have to work with, such as version/distro of Linux, what database/web/apps you're talking about, etc., there's nothing we can tell you. Could be as simple as doing an SSH keyswap between the systems, and having the script on the app server shut down the apps, then run an SSH command on the web server to shut IT down, then shut down the database. However, this seems VERY unlikely...why does the database need to be shut down for backup? Hot backups can be done on most databases...apps and web shouldn't be affected at all.
 
1 members found this post helpful.
Old 08-24-2020, 06:03 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 5,131

Rep: Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876Reputation: 1876
Quote:
Originally Posted by LYC View Post
Hi,

We have 3-tier applications installed in different servers: apps server, web server and DB server in our environment. The backup will start backup when apps, web and DB are shutdown in sequence. The applications will need to startup after the backup completed.

As the applications are installed in different servers, how to write a script to coordinate to shutdown and startup for the backup?

Thanks in advance.
I agree with TB0ne. There should be no need to shut down anything to do backups. I run hot backups every day.
Applications tend to be static. Certainly they are only changed when updated, which presumably is a managed process.
Not sure what is backed up for the web server except the content. Again, that's static and can be copied while the server is running.
A hot database backup can be a little trickier to recover from than a cold backup, but otherwise it should be do-able.
 
2 members found this post helpful.
Old 08-24-2020, 08:32 PM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,756

Rep: Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408Reputation: 4408
Well, first, by "shut down", you'd better mean shutting down the services and not shutting down the machines.

Other than that? I'd just have the script execute commands over SSH. And that includes the commands to initiate the shutdowns.

Last edited by dugan; 08-24-2020 at 08:35 PM.
 
2 members found this post helpful.
Old 08-25-2020, 04:28 AM   #6
Michael Uplawski
Member
 
Registered: Dec 2015
Location: Outside, most of the time.
Posts: 933
Blog Entries: 26

Rep: Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547Reputation: 547
Reading the other contributions does not dump my first impulse to wonder about: “We”, “different servers” and the general “environment”. None of these fall from the sky out of a sudden. If they ever worked and worked together, then somebody was there before you. Database... I cannot believe that you are alone in your specific environment.

Short version: Do you communicate at yours?
 
2 members found this post helpful.
Old 08-25-2020, 12:31 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,434
Blog Entries: 11

Rep: Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398Reputation: 3398
As already noted by others, your quiestion does not provide sufficient detail about your environment or what you are trying to accomplish for other members to provide any specific help. Rather than asking "how to write a script" for your task, you should first try to solve the problem yourself then ask for help with specific items you cannot resolve. This will help you understand the problem and frame your question more clearly.

Please review the Site FAQ for guidance in posting your questions and general forum usage. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
c shell scripting queries LYC Linux - Newbie 5 09-04-2015 07:13 AM
Scripting queries - Newbie LYC Linux - Newbie 5 09-19-2014 05:49 AM
queries abut awk scripting mbalaji Linux - Newbie 2 10-17-2012 02:13 AM
Firefox Scripting Add-on (Scripting HTML / Javascript inside Firefox) linuxbeatswindows Programming 1 09-18-2009 10:09 PM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 04:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration