Reputation
935
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
3 9
Newest
 Yearling
Impact
~36k people reached

  • 0 posts edited
  • 0 helpful flags
  • 111 votes cast
Apr
7
comment control a bash script with variables from an external file
Needs improvements: a more robust example could be : OPTIND=1; SILENT=":"; while getopts "${SILENT}a:bc:" opt ; do case $opt in a) val=$OPTARG; ... ;; b) ... ;; c) val=$OPTARG; ... ;; :) echo "(silent mode): -${OP TARG} needs argument"; ... ;; ?) echo "(non-silent) : option not recognized"; ... ;; esac ; done ; shift $((OPTIND - 1)) . OPTIND is set to 1 so you can call the getopts multiple times if needed, and the shift makes sure you process the remaining args only. By default, processes the $1 ... $n, but can process other args if you put them after the "opt" and before the ";" above
Apr
7
comment control a bash script with variables from an external file
@Zoredache: like Dennis said, you should avoid the cat $configfile | while ... done by moving it over to while ..... done < "$configfile" so that all the variables you define or modify in the while are not just for the while's duration (if it is in a subshell) but exist after it as well. And it is one less "UUOC" (Useless Use Of Cat)
Mar
10
comment How to get the Linux OOM killer to not kill my process?
That's a thorough (and well explained) answer !
Mar
7
revised How to get the Linux OOM killer to not kill my process?
fixed the links
Mar
7
revised How to get the Linux OOM killer to not kill my process?
added 282 characters in body
Mar
7
revised How to get the Linux OOM killer to not kill my process?
rearranged the links
Mar
7
comment How to get the Linux OOM killer to not kill my process?
disclaimer: I can not give more detailled infos than the few links above, as I can't access a linux system at the moment... and there are so many things to check. Maybe someone will step in and provide nice step by step procedures... (the serverfault answer, last of the "good reads" link in my answer, was like that, and is an incredible read.)
Mar
7
comment How to get the Linux OOM killer to not kill my process?
@Iain: thanks, I edited that into the answer.
Mar
7
revised How to get the Linux OOM killer to not kill my process?
added good link + precision from Iain about the newer name of the oom adjustment
Mar
7
answered How to get the Linux OOM killer to not kill my process?
Jan
22
comment How do I get current Unix time in milliseconds using bash?
@CamiloMartin: I love your (tongue-in-cheek?) wget exemple to get milliseconds precision out of a (remote) request to a website ^^. Locally, a few of the examples above are indeed probably closer to the tenth-of-a-second or maybe hundredth-of-a-second precision
Dec
17
comment How do you disable the “last accessed” attribute on NTFS/Windows?
just a comment about the linux "noatime": in many cases it's safer (and almost as efficient) to use "relatime", with linux fs/kernels >2008. relatime will write the atime only if the file was updated since the last atime, or X days/hours passed (default 24h?).
Nov
21
awarded  Yearling
Sep
24
comment Running 100 virtual machines on a single VMWare host server
You have "this amount of cpu" in your hosting server, and each VMs will get a share of it. Plus esxi will have overhead : "switch to this VM, manage it, switch to the next, etc", many times per second. It means each VM will get only a fraction of the total cpu. The more VMs, the more you divide your cpu (and the more overhead you also add, which means instead of having 100 vms, you in fact have quite a bit more).
Sep
24
comment Rsync triggered Linux OOM killer on a single 50 GB file
you should also verify that your kernel does allow swapping (ie, swapping is not turned off) (and you should dedicated a bigger chunk of disk space, let's say 16Gb or even 32Gb). Some weird persons on the net recommend to turn swapping off, which is very wrong.
Jul
15
comment some IPs within a subnet not reachable
you have wrong gateways (0.0.0.0, which will either try to broadcast to both, or most likely will go to the first interface (and explains why only the outside will receive those replies). just define each interface with its ip, network, and its ip as default gateway. and add a default gateway routing everyrhing else (0.0.0.0/0) to the proper default gateway (1.2.3.65) (like you already have, on the 4th line)
Feb
16
comment How to protect against loss of server on a budget
Good and easy way to present it. (But ... I'd just add some price somewhere, as 3 to 10 times "free" is still free ;). Or, of course, you mean the overall cost of the service itself? )
Feb
12
comment Do you have any useful awk and grep scripts for parsing apache logs?
Elegant and simple. Good.
Feb
12
comment Command line tools to analyze Apache log files
I'm very surprised... I didn't "criticize" at all, just pointed 2 remarks (and said that indeed the method you used can be usefull in other cases, but here is just not needed)...
Feb
10
comment Command line tools to analyze Apache log files
2 remarks: The date is not really in field 4 but in fields 4 + 5 ^^ (without the shift from GMT, the date has little value). And an access_log has most of the time 12 fields form (actually, there could be more than 12 fields, as the 12th is the http agent, which can contain many spaces in its name too.. the first 11 fields are easy to parse, and the 12th field (and maybe more) remaining should be the http agent). So you can just: awk '($9 == 200) {print $6,$7,$8}' to display the same thing as in your example. No need to use FPAT there (even though this method can be usefull in other cases)