Scripting

Script Automation in Linux using Crontab

Posted on Updated on

Hello,

Today I would like to discuss regarding script automation using Crontab. Let’s start first with what I meant by Script Automation?- Let’s say You want to run a script after every five minutes. How you can do that? Running the script after every five minutes manually? Well, that’s where script automation comes.

Now, it’s turn about Crontab. So for this, I would like to tell you to use Google!!!.

First, Write a script. A script that will measure the memory usage and if the memory usage is greater than a certain value then it’ll send an email.

So here is the script:

Read the rest of this entry »

How to Read from INI file through Batch File

Posted on Updated on

Let’s assume we have a config.ini file like below:

userName="hemel"
password="password"

What we want to do is to read these value through a batch file. So let’s create a batch file named “test.bat” with following commands:

@echo off
for /f "tokens=1,2 delims==" %%a in (config.ini) do (
if %%a==username set username=%%b
if %%a==password set password=%%b
)

echo %username%
echo %password%

keep in mind that, the path of the config.ini file should be updated according to your file structure. In this case both of the files are at the same level.

Enjoy 🙂