Re: OT: how do you write your tools /scripts for everyday tasks
Markus Rosjat writes: > So what you guys using these days, is it shellscripts, c programs, > perl or? I've moved almost all my sysadmin automation to ansible. Ansible provides a large library of modules that handle most common things in an idempotent way. https://docs.ansible.com/ansible/latest/index.html I still use shell scripts for some things, cron jobs and other housekeeping-type things. Allan
Re: OT: how do you write your tools /scripts for everyday tasks
> > > Or when the tool would be running long enough that the performance > difference matters. Also, Javascript/Perl/Python/Ruby/shell all tend > to be lousy at dealing with anything where control over timing is the > overriding issue. > > Or when your target environment needs you to be miserly with your memory > use. > > Or, for practice. > > Or, sometimes, just because there are some things where C is more > convenient and comprehensible. > All points are valid, but I believe they rarely happen with onetime tools. At least on x86. AFAIK, initial approach was to create "big" tools with C, and then use scripts to "glue" them. See: https://wikipedia.org/wiki/Programming_in_the_large_and_programming_in_the_small https://wikipedia.org/wiki/Ousterhout%27s_dichotomy But nowadays many big projects are written with scripts. C is ok, but it has price: manual memory management, no separate type for strings, no fancy exceptions that report errors to stderr automatically etc)
Re: OT: how do you write your tools /scripts for everyday tasks
On Wed, May 30, 2018 at 9:51 AM, IL Ka wrote: > There is no reason to use C for "onetime tools" except cases when no other > API exist. Or when the tool would be running long enough that the performance difference matters. Also, Javascript/Perl/Python/Ruby/shell all tend to be lousy at dealing with anything where control over timing is the overriding issue. Or when your target environment needs you to be miserly with your memory use. Or, for practice. Or, sometimes, just because there are some things where C is more convenient and comprehensible. And maybe for things I haven't thought of. But, other than that, yes. That said, to address the question raised by the original poster: these days, for me, it's been mostly php, perl, shell and sql, with a few makefiles thrown in for good measure. Oh, and a bit of javascript and a bit of svg. A good bit of that is a reflection of my current job, though. [I started learning php last december, for example - and php 7 is almost a reasonable language, unlike previous versions.] If I was working on more practical issues, I would probably focus on C and/or an assembly language (or something close to that - maybe a forth, for example). Thanks, -- Raul
Re: OT: how do you write your tools /scripts for everyday tasks
Hello, Running external process from Python script is not good in most cases. It is better to use wrapper or binding. Search pypi.org for it. I use shell (ksh,sed,awk,tr,mail etc) for simple tools, and Python for something which is more complex. Python is used for scripting in many modern linux distros, but OpenBSD base system has Perl which was "defacto" script language in **nix world since late 80th. Package management is writtern with Perl. Both languages have excelent package collections. Perl CPAN and Python pypi have everything from tmux session management to webservers. Some people also use Ruby which is somewhere between Perl and Python, and also works well on OpenBSD. I've even seen nodejs/javascript used for system scripting. There is no reason to use C for "onetime tools" except cases when no other API exist.
Re: OT: how do you write your tools /scripts for everyday tasks
On 18/05/30 14:29, Markus Rosjat wrote: Hi all, this is more a post to get an overview how the pros (not me ... you guys) put there tools together. I can write simple shell scripts and this is ok but I do a little python coding once in a while and noticed I'm going to write my tools in python. Sure its a little overhead and most of the time you ending up using subprocess to call a existing tool that you would use on a cmd anyway. So what you guys using these days, is it shellscripts, c programs, perl or? I write usually shell-scripts for /bin/sh, so no bash-isms etc. But depending on the use case I might use python. Niels
OT: how do you write your tools /scripts for everyday tasks
Hi all, this is more a post to get an overview how the pros (not me ... you guys) put there tools together. I can write simple shell scripts and this is ok but I do a little python coding once in a while and noticed I'm going to write my tools in python. Sure its a little overhead and most of the time you ending up using subprocess to call a existing tool that you would use on a cmd anyway. So what you guys using these days, is it shellscripts, c programs, perl or? Would be cool to get some feedback on that :) regards -- Markus Rosjatfon: +49 351 8107223mail: ros...@ghweb.de G+H Webservice GbR Gorzolla, Herrmann Königsbrücker Str. 70, 01099 Dresden http://www.ghweb.de fon: +49 351 8107220 fax: +49 351 8107227 Bitte prüfen Sie, ob diese Mail wirklich ausgedruckt werden muss! Before you print it, think about your responsibility and commitment to the ENVIRONMENT