Automating tasks - Servers Administration, Networking, & Virtualization
Users browsing this thread: 3 Guest(s)
|
|||
Hello fellow nixers,
I'm curious to know more about your automation scripts, regarding daily administration, security, workflow and so on. Because IT guys are lazy, it is a good thing to script tasks as much as possible. Do you have any oneliners or posix compliant script you'd be proud to share/explain? Even dirty piece of code are welcome. Expecting tr0lls, I know wmutils is based on scripts, and that's why it's so delightful! The first one I could show you is a script based on vnstat generating graph about network activity. I usually launch it when turning the computer off. A crontab is also in charge of executing it if I don't do it by myslef (thinking about my VPS). It allows me to have an idea of the amount of network activity (and to show off a bit as well). This is how it looks like when it is properly configured: Will share the source code as soon as I get back home. Cheers |
|||
|
|||
(17-06-2016, 09:03 AM)sagittarius Wrote: I'm curious to know more about your automation scripts, regarding daily administration, security, workflow and so on. This is a vague subject to discuss, as almost everything can be automated. LITERALLY EVERYTHING. Maybe it would be wiser to think of the wider aspect of it: What to take in consideration when automating tasks. But then again, there are so many types of tasks. What should you go for, on hardware events, periodic runs, manual runs but automatic process, on new log generations, etc.. Even just automatically remapping your keys on boot can be said to be a task automation. I'll still contribute with a cool link: For Security there are those automation scripts for the after the facts: http://linuxforensicsbook.com/code.html You could take those scripts as a base as what to check in your daily administration, yet again it depends on what you are administering. |
|||
|
|||
I have a few scripts I use everyday, but no one automate anything in the background.
This is really not administration nor security, only for the "and so on"... The only two thing I currently automate are: Tags in the terminal window manager DVTM, just like [/url]: .profile Compilation. I have a few projects I prefer to compile myself, like if I want to change one of the files (like the config.h), apply a patch (like for dwm, st, or if I made my own patch, edited the source). |
|||
|
|||
I automated my backupping, for example (yes, I wrote my own script for that. Shame one me.).
When thinking about writing a general script, I try to abstract my task and find the smallest and fastest possible solution (hint: don't spawn too many processes) and then I write it down. Most of my commands are just saved in my command line history, and my shell (fish) has a really good searching function and autosuggest what makes me easily find whatever I want. I don't really have any scripts running constantly in the background, but the scripts I wrote can be found at https://github.com/pranomostro/script I use shell functions for aliasing stuff, everything more complex than adding a default flag or wrapping with rlwrap deserves an own script. For building, I use make (it's everywhere) and also shell scripts. |
|||
|
|||
|
|||
(18-06-2016, 06:19 AM)venam Wrote: some rsync commands For what I need, rsync is an overkill, and needs to be installed/compiled on the targeted platform. With a shell script, I can keep it along with my data on my USB key, and run it on any UNIX. Code: lsync(1) Mirroring utility lsync(1) Example of output it produces on screen: [EDIT]: That way, I can grep the output for '>>>' or ' > ' to see what is overwritten or copied from left to right, '>' to see whatever comes from left to right... It only contains these commands + shell builtins: <code> mkdir find cut -c tee sed sort uniq tee grep -v cp -p cp -pf </code> But I would not recommand to use it in production, as I am a beginner, and there may be many flaws to it. The script: lsync (17-06-2016, 11:26 PM)pranomostro Wrote: https://github.com/pranomostro/scriptOh, so you keep a fork bomb in your scripts, interesting. :) |
|||
|
|||
One can never know when a bomb may be needed.
Edit: btw, lsync looks really good. |
|||