|
Bhodi posted:Just spent 10 minutes on google; simple answer: You can't. At least not trivially. The poo poo's splattered all over the system and stored in /proc and various other places, from what I can gather. it's extremely easy in most languages Perl code:
code:
|
# ? Feb 24, 2015 05:03 |
|
|
# ? May 27, 2024 06:36 |
|
e: ^ well whata ya know i dont know if many ruby programs manage it lol
|
# ? Feb 24, 2015 05:03 |
|
I've never had the balls to try and edit a /proc/pid/cmdline so I don't know. This really scary blog entry says it's possible with compiled c: http://stupefydeveloper.blogspot.com/2008/10/linux-change-process-name.html I sure as hell wouldn't want to play with that in production though I'm pretty sure your simple example has flaws, because I'm certain I read that you can change it after execution but it doesn't store that in /proc, only locally somehow. I'll play around with it tomorrow.
|
# ? Feb 24, 2015 05:05 |
|
try setting $1? changing argv[0] requires some work on certain systems (setproctitle or equiv) but copying into the right other element of argv should be simpler
|
# ? Feb 24, 2015 05:07 |
|
Yeah dunno if it (setting argv[0]) works in ruby, it doesn't in python apparently http://stackoverflow.com/questions/564695/is-there-a-way-to-change-effective-process-name-in-python but some guy wrote a thing to do it https://code.google.com/p/py-setproctitle/ E: ah ha, snack overflow: http://stackoverflow.com/questions/450620/change-the-ruby-process-name-in-top Bhodi fucked around with this message at 05:11 on Feb 24, 2015 |
# ? Feb 24, 2015 05:08 |
|
Bhodi posted:I've never had the balls to try and edit a /proc/pid/cmdline so I don't know. that scary blog entry is about changing another process' argv, not your own nothing is stored in /proc, it's all computed from process data. if you just want to mask out a password then overwriting that element of argv should be portable. whether that requires FFI in ruby depends on how magic its reflections of argv are
|
# ? Feb 24, 2015 05:11 |
|
just write your own top idgi why do you want to change the name anyhow
|
# ? Feb 24, 2015 05:11 |
|
And they call me a senior sysguy.... christ. I hope no one from work ever sees this thread
|
# ? Feb 24, 2015 05:12 |
|
Bloody posted:just because you are struggling to chop down a tree with a hammer does not mean the hammer is faulty it means you're 16 and just because you can doesn't mean you should alternate answer: it just means the hammer's ill-fitted for the job and the tool manufacturer refuses to produce anything else
|
# ? Feb 24, 2015 05:21 |
|
MALE SHOEGAZE posted:just write your own top idgi to delete passwords from the cmd args
|
# ? Feb 24, 2015 05:43 |
|
Bhodi posted:Yeah dunno if it (setting argv[0]) works in ruby, it doesn't in python apparently http://stackoverflow.com/questions/564695/is-there-a-way-to-change-effective-process-name-in-python but some guy wrote a thing to do it https://code.google.com/p/py-setproctitle/ ruby is just like perl, you just set $0='whatever' (yes the $ is required)
|
# ? Feb 24, 2015 05:44 |
|
bucketmouse posted:and then you implement a dynamically-typed tableview in it and you stop having this delusion adding objects to c has been done horribly by many and beautifully by a few. objective-c all the way.
|
# ? Feb 24, 2015 05:44 |
|
i think objective c was a really bad place for me to learn about memory and stuff
|
# ? Feb 24, 2015 05:45 |
|
obj-c owns owns owns for stuff like uis or anything where you want to wildly spew messages at arbitrary collections of objects and not give a gently caress sucks to see people try to write math libs and such in pure objc though and just not understand why their algorithm's furious message passing runs at like 1/10th of the speed it did in matlab
|
# ? Feb 24, 2015 06:37 |
|
Notorious b.s.d. posted:it's extremely easy in most languages hey I just got a great idea for a new inter-process communication method
|
# ? Feb 24, 2015 10:58 |
|
qntm posted:hey I just got a great idea for a new inter-process communication method
|
# ? Feb 24, 2015 13:37 |
|
i'm thinking of rewriting a process management system that's written entirely in bash in java or scala, cause i need to add a bunch of new features to this thing and i feel like bash is just getting in the way i'm doing something similar for a website we have that is sloppily coded in php should i just be bashing the new features and designs everyone wants into these lovely programs in lovely languages or is rewriting acceptible in this case?
|
# ? Feb 24, 2015 14:32 |
|
Try Erlang
|
# ? Feb 24, 2015 15:16 |
|
just use files
|
# ? Feb 24, 2015 16:15 |
|
Condiv posted:i'm thinking of rewriting a process management system that's written entirely in bash in java or scala, cause i need to add a bunch of new features to this thing and i feel like bash is just getting in the way use java or c#
|
# ? Feb 24, 2015 16:27 |
|
Adding on to the existing systems will only make them harder to fix in the future. Trying to go to a fad lang will only cause headaches and get in the way of implementation. Using java or c# will allow you to quickly and efficiently address the problem with the least amount of work possible.
|
# ? Feb 24, 2015 16:30 |
|
i'm not usually a fan of ground-up rewrites, but rewriting a bash codebase into pretty much anything else is a good idea
|
# ? Feb 24, 2015 16:41 |
|
you can use perl more like a slight step sideways and upward, not unlike a handicap ramp, but it is debuggable and can be written clearly and has a ton of good libraries in cpan
|
# ? Feb 24, 2015 16:50 |
|
yes you can recommend perl to replace bash things thats what it was for
|
# ? Feb 24, 2015 16:50 |
|
Share Bear posted:yes you can recommend perl to replace bash things thats what it was for yeah, this is basically the sweet spot for Perl I had to (read: mustered the courage and political capital to) rebuild a 10KLOC bash test suite runner in another language, and the approach that worked best was to factor into the smallest commands possible, replace those commands with standalone programs in the new language, and then merge those micro-programs as appropriate once things were converted. writing unit tests for the small components was tractable, but the initial factoring was basically leap-of-faith and lots of set -x.
|
# ? Feb 24, 2015 17:01 |
|
If you're rewriting something today, I'd think python might be a better choice for that over perl. Perl is good for one-liners and scripts that do one thing, commands you want to pipe in/out of STDIN, python is better for larger, more fully featured programs with a bunch of components. Plus, I don't know anyone who's under 25 who knows perl at all. I don't think they really teach it anymore; and most newer "OS-y" things are being written in python over perl (or ruby....) I'd break into a cold sweat if I was asked to manage a process management system in bash. BTW Notorious bsd, thanks, it works code:
|
# ? Feb 24, 2015 17:38 |
|
python's process control stuff is a pile of rear end, though maybe that's mostly on windows
|
# ? Feb 24, 2015 17:48 |
|
Subjunctive posted:python's process control stuff is a pile of rear end, though maybe that's mostly on windows if you mean the subprocess module then it's pretty bad on linux too then again I've never used a process control library that wasn't a pile of rear end so maybe it's an inherently horrible thing to do
|
# ? Feb 24, 2015 19:35 |
|
Soricidus posted:if you mean the subprocess module then it's pretty bad on linux too it's awkward as heck but still better than bash scripting
|
# ? Feb 24, 2015 19:36 |
|
arguing about whether to replace shell scripts with ruby, perl, or python is dumbfuck bikeshedding. i really, honestly don't care which one is chosen. they're all good in this problem space. i'm happy to work with scripts written in any one of them. just don't use bash.
|
# ? Feb 24, 2015 22:24 |
|
Notorious b.s.d. posted:just don't use bash. you're lucky if people are only using bash imagine if they were using ksh. ksh88, that is. or csh, and I don't mean tcsh. sometimes, even bash is a step in the right direction.
|
# ? Feb 24, 2015 22:28 |
|
qntm posted:hey I just got a great idea for a new inter-process communication method
|
# ? Feb 24, 2015 22:41 |
|
Soricidus posted:you're lucky if people are only using bash ksh and bash are pretty much equivalent. even ksh88. i give no fucks i've never seen a large codebase in csh. i think it's so user-hostile in non-interactive use, it defies the attempt
|
# ? Feb 24, 2015 23:16 |
|
Notorious b.s.d. posted:arguing about whether to replace shell scripts with ruby, perl, or python is dumbfuck bikeshedding. use scala
|
# ? Feb 24, 2015 23:22 |
|
b0lt posted:use scala no don't
|
# ? Feb 24, 2015 23:27 |
|
Notorious b.s.d. posted:ksh and bash are pretty much equivalent. even ksh88. i give no fucks the thing with a large codebase in ksh88 is that so much of it is almost but not quite the same as bash ... so even if you find a shell scripting wizard to maintain it, odds are they'll gently caress it up in the attempt. as for csh, I'll admit I haven't seen large codebases in it, but I've certainly seen a system that used it exclusively for the glue, and it was every bit as bad as you think.
|
# ? Feb 24, 2015 23:35 |
|
qntm posted:hey I just got a great idea for a new inter-process communication method how about a log system http://cr.yp.to/daemontools/readproctitle.html
|
# ? Feb 25, 2015 00:28 |
|
Notorious b.s.d. posted:arguing about whether to replace shell scripts with ruby, perl, or python is dumbfuck bikeshedding. youre in luck then, because it's not your decision to make in this instance
|
# ? Feb 25, 2015 00:47 |
|
Condiv posted:i'm thinking of rewriting a process management system that's written entirely in bash in java or scala, cause i need to add a bunch of new features to this thing and i feel like bash is just getting in the way ideally start by finding a premade tool or library that will do 90% of the stuff you want and make a wrapper on that i guess that sounds obvious, but i've been burnt before by kind of assuming that if someone made a huge custom shell script for this 5 years ago, there couldn't possibly be a generic simple solution somewhere on github now.
|
# ? Feb 25, 2015 00:49 |
|
|
# ? May 27, 2024 06:36 |
|
wrote and then resolved my first redmine ticket ever today i even had to do a git
|
# ? Feb 25, 2015 01:31 |