1
I am trying to set ulimit
when starting an EC2 instance on Amazon Web Services.
Is there any way to write a script that will:
sudo
root to setulimit
, then:- Log out and back in as my original user in order to run some commands?
1
I am trying to set ulimit
when starting an EC2 instance on Amazon Web Services.
Is there any way to write a script that will:
sudo
root to set ulimit
, then:1
sudo ulimit -n number_of_files
ssh localhost
or su - username
It works interactively, but when I put the following into a script, it does not work well. Here is my script: `sudo bash
ulimit -n 1000000 su - hadoop` – Jiang Xiang – 2015-03-24T00:01:45.977
Can you provide more clarity about exactly what you're trying to do? Are you testing different values of
ulimit
? Do you just wantulimit
to be set to a given value every time you log in? – hBy2Py – 2015-03-24T00:08:05.727I am starting a new EC2 instance every time I run the script. So that I am not able to set
ulimit
manually. I do wantulimit
to be set to a given value every time I log in. – Jiang Xiang – 2015-03-24T00:09:20.8171
Ah, so really what you want to be able to do, I think, is to customize limits.conf (http://ss64.com/bash/limits.conf.html) for each new instance you spin up. That's an AWS question, and I have no experience there. You may want to edit your question to be more general, to clarify this.
– hBy2Py – 2015-03-24T00:14:55.283Googling a bit, I found another possibility. See my edit. Also, in your particular script, you probably need to put a semicolon in there to break up the commands:
sudo bash ulimit -n 1000000; su - hadoop
orsudo bash ulimit -n 1000000; ssh localhost
. – hBy2Py – 2015-03-24T00:20:38.837