I’ve directory called /home/vivek/scripts/daily with over 25 perl / shell / python scripts for managing daily tasks. One day for some weird reason my crond died and I did not noticed the incident for 2 days. Now crond is started and I’d like to run all those scripts. Here is a quick for loop running [...]
Generally I use Perl and Shell script for automation or to make system administration easier for me. Python is an interpreted, interactive, object-oriented programming language that combines remarkable power with very clear syntax. Python runs on Windows, Linux/Unix, Mac OS X, OS/2, Amiga, Palm Handhelds, and Nokia mobile phones. You can easily adopt Python to [...]
When invoked without arguments, the date command displays the current date and time. Depending on the options specified, date will set the date and time or print it in a user defined way. I’ve seen many sysadmin writing perl scripts for calculating relative date such as yesterdays or tomorrows day. You can use GNU date command, which is designed to handle relative date calculation such as:
- 1 Year
- 2 Days
- 2 Days ago
- 5 Years
Reading an IP address in shell script required many time. However, different Linux distribution stores IP address in different files. If you are looking to run script under different UNIX like OSes such as Solaris or FreeBSD then you need to use the ifconfig command. The ifconfig command is not just used to configure a network interface, but it can be use to obtained information such as network IP, netmask and much more.