Everyone who worked as a sysadmin of UNIX-systems, sooner or later begins to automate their work using scripts.
They can be written on anything - from bash to tcl. The approach is important.
In this article I will try to briefly describe the techniques of scripting automation.
When do I need to write scripts?
1. When it will save time.
If you need to configure 1000 switches in the same way, send
spam invitations to the conference or collect the MAC address base - the scripts are our best friends.
')
2. When certain actions are performed regularly.
Archiving backups, cleaning up a mysql database of garbage or collecting statistics are the very cases.
3. When you need to create something complicated, but lazily to do it "seriously."
Examples are microbills, traffic counters and debtor blocking systems.
It needs to be written in C / C ++. But the authorities said: “Make it today!”. And again the scripts - and the idea of "someday rewrite." :)
When do not need to write a script?
Always, when it is not necessary according to the first three points.
Although if you want - write. Your time. :)
Some examples from personal life
1. Script fixes all mysql tables. I put it on a krona hosting account - calls to subscribers on non-working sites on mysql immediately disappeared. [bash]
2. Mass execution of commands on AT-8000S switches. [perl]
iplist.txt - a list of switches in the ip: login: password format
command.txt is a list of commands.
3. Checking the operation of the daemon - useful in the presence of falling programs.
You can remove the while and stuff it into the crontab.
4. Daily backup with cramming according to daddies of the form <year> / <month> / <day>.
In crontab.
Conclusion
Scripts can be written. Scripts need to write. Good luck. :)
PS I apologize for the sloppy - the first post on Habré.