Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I am required to run a couple of batch scripts at frequent intervals on multiple servers. This requires me to log in to each server every time.Is there an easier way to do this?
Thanks in advance.
Use a screen manager such as screen or tmux to keep the sessions alive if you need an interactive session to do your monitoring.
If you just need to poll for data, ssh allows you to pass a command like this
ssh username#hostname 'command'
You can stick this into a bash script and use cron to run it regularly.
Install a cron job at these servers. Then, it depends on the servers and infrastructure how you can access the output, if you need it.
Related
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've looked at Amazon EC2 for some basic script I need to run sometimes.
My only issue at the moment is that I've done some test and read some documentation, but I still don't know if it's possible to do a script to get the instance (like rent it) then ssh, upload my script and run it.
From what I've looked it's possible to ssh, scp my script and run it, but I have no idea for the first step.
If someone has an answer or some example, it would be greatly appreciated.
Thank you.
Bdloul
You'll probably want to to start by launching an instance through the wizard by selecting launch instance on your ec2 console (console.aws.amazon.com > ec2).
Then check out the ec2 command line tools. You'll be able to check out instance, check the status of instances, ssh into them, scp up to them, and start your script. Check back when you hit a snag.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I need to write an install script that runs an executable/script on login (not startup) in Linux. This needs to work for all current users who can log into the system and users created in the future as well. Is there a way to do this?
In windows this can be achieved by putting a shortcut in the startup folder for "All Users". Is there a similar location/init script in Linux? If not, are there any alternatives?
Thanks in Advance!
The users ~/.bash_profile or ~/.profile depending on shell is executed at login. You can add to that. If you want it for every user, you could put it in /etc/profile.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
my organisation have two physical servers and some VMs. Currently when there is a pre-scheduled power outage, I use a script I wrote to loop through all VMs scheduling a shutdown command to all VMs and the servers. For example,
ssh root#${VMS[$i]} 'echo "shutdown -h now" | at 05:00am Mar 31'
Then I restart the machines when I am back to the office in the morning.
Is this the appropriate way of doing the auto shutdown? Do you do it differently? Thanks in advanced.
For starters, the shutdown command can take a time directly itself, you don't need to use at for that (see http://www.computerhope.com/unix/ushutdow.htm).
Beyond that, though, I don't see anything wrong with this approach, provided that your environment can tolerate those servers being offline potentially longer than necessary (i.e. if a power outage lasts from 9-10 pm, but you don't start them back up until 8 am the next morning, that's 10 hours longer that they were off than they really needed to be), which your description seems to suggest is the case. In this environment, I don't think I would do anything differently, beyond also scheduling the host computer to shutdown a couple of minutes after the VMs are scheduled to do so.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
Is there any way to setup my SSH client or my GNOME terminal or whatver so that when I SSH into a remote server it opens up TWO connections (or tabs or whatever)?
I always like to have two SSH connections to my remote servers open - one for displaying log files and another to do actual work. It bugs me that I have to login twice everytime.
Possible? Sensible? What's the verdict?!
I'm not sure what you're trying to accomplish. If you only have one terminal open, where would the two connection send output and get input? You might find something like "screen" useful that lets you have multiple virtual terminals that display to a single physical terminal. You use a key sequence to switch between them. I use it all the time when working over a remote login to a Unix box. It's also nice because you can re-attach to your virtual terminals if you lose your connection.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 13 years ago.
Improve this question
I see this every time I ask questions about backing up sql through php, but I don't know what is it, or how to install it, or how to use it in my computer(windows xp) to backup mysql database.
Cron is a UNIX utility for running commands at specific times. A cron job is a such a commend when cron has been configured to run it.
On Windows you would likely use the Scheduler instead.
A cronjob is a unix term for a system process (cron) that allows you to schedule tasks to run at a later date under a specified set of privileges.
On Windows, I suggest you create a batch file for your backup, and use the Task Scheduler to run it at the desired time.
cronjobs are available on Linux/Unix machines. These are scripts which you schedule to run at specific times (daily, hourly, monthly).
They are controlled by the unix command "crontab"
To list all of your cronjobs use crontab -l. To edit the list of cronjobs use crontab -e