jusupov.com

Computer Technology Blog

Archive for the ‘Programming’ Category

How to monitor disk space in Linux boxes

with one comment

Sometimes, you will need to monitor your disk space on some linux servers in your network. You may install monitoring tools like Zabbix, however this may be too much, may be you just need to monitor disk usage on the box. You can use this script to e-mail you every morning with the disk usage on the box:

#!/bin/sh
address="root@localhost";
cicl="2 3 4 5 6";
# ?????????? ? ????????? ????? ???????????? ????? ??? ??????? ???????,
# ??? ??????? ?????????? ?????????
predel[2]=80;	# /
predel[3]=80;	# /usr
predel[4]=60;	# /var
predel[5]=80;	# /tmp
predel[6]=80;	# /home
varning="0";

count=0;
df -h > /tmp/tmp_df;
while read -r FS S Ud A U MO; do
	let count+=1;
	FileSystem[$count]=$FS;
	Size[$count]=$S;
	Used[$count]=$Ud;
	Avail[$count]=$A;
	Use[$count]=$U;
	MountedOn[$count]=$MO;
	NUse[$count]=${Use[$count]%"%"};
done < /tmp/tmp_df;
table="";
for c in $cicl; do
	if [[ ${NUse[$c]} -ge ${predel[c]} ]]; then
		varning="1";
		table=$table"n${FileSystem[$c]} t${Size[$c]} t${Used[$c]} t${Avail[$c]} t${Use[$c]} t${MountedOn[$c]}";
	fi
done
		shapka="nFileSystem tSize tUsed tAvail tUse tMounted On";
		body="Regard admin, please check, place on disk:"$shapka$table;
		#echo -e $body;
if [ $varning -eq "1" ];
    then
	echo -e $body | mail -s"Warning on server" $address;
	logger -i -p cron.warn -t dfmonitor "Send warning to $address";
    else
	logger -i -p cron.info -t dfmonitor " Place on disk in rate";
fi

You can call this shell script whatever you want and don’t forget to add this into your crontabs.

The script is courtesy of OpenNet.Ru

Written by Arstan

May 11th, 2007 at 1:34 am

JavaFX – new scripting language, AJAX replacement?

with one comment

MENLO PARK, Calif. — You know all that AJAX code you’ve been writing and tearing your hair out over as you attempt to get the JavaScript working in both Internet Explorer and Firefox? Yeah, that AJAX code (define).
It’s all going to be useless real soon.

Sun Microsystems gave journalists a sneak peak at a new scripting language, JavaFX, which it will introduce at the annual JavaOne show in San Francisco today. JavaFX is a new extension to the Java platform that promises a consistent experience from desktop to handheld devices.

The language offers interactivity, animation and programming consistent with AJAX, Adobe’s Flash and Microsoft’s new Silverlight technology, but employs the Java runtimes installed on your local client instead of clumsy JavaScript.

JavaFX will ultimately be an entire product family. One of the first products will be JavaFX Script, which is designed for content authoring of Web and network-facing applications.

via – InternetNews

Written by Arstan

May 8th, 2007 at 8:44 pm

Posted in Programming, internet

Why server side validation is important or why spammers love JavaScript validations

without comments

It was those days when you could just leave your email out there, have contact, registration and etc forms without any forced validations, only few companies like Yahoo! had CAPTCHA validations…

Yes, those were the days! But now we have JavaScript, CAPTCHA, Audio, Server Side validations to avoid spam and misuse of the forms.

Now, when you are preparing a simple contact form which will email you submissions or feedback form for your company, order forms etc it is come to a point where JavaScript validation is not sufficient. Spammers do love JavaScript validations because they can just bypass them easily. Try it yourself, go find that kind of contact forms and disable JavaScript on your browser and just hit Submit button. See, it says submitted successfully. Read the rest of this entry »

Written by Arstan

May 4th, 2007 at 1:20 am

Posted in Programming, freelance

DataStreams – CSV Reader

without comments

Sponsored Post
When developing applications for big companies who had some legacy systems/applications running, and you are required to do the Data Extraction from the legacy systems import to your application. This, sometimes, can be really hard, especially when there are missing data in some rows, or some data extractions are comma delimited, some tab and some with other format like XLS, XML etc. Here’s the definition from their website:
DataStreams is a component library for .Net developers to easily integrate data from various formats like CSV, Excel, and XML into their applications.

Csv Reader is an extremely fast and stable .Net class for stream based parsing of virtually any commonly found delimited data format, CSV files, tab delimited files, etc. It’s usable from C#, VB.Net, ASP.Net, or any other .Net language. It’s compatible with the 1.0, 1.1, and 2.0 .Net frameworks.

Read the rest of this entry »

Written by Arstan

May 3rd, 2007 at 10:14 pm

Backup multiple MySQL Database Servers

with one comment

At my current place we have several internal MySQL Databases used for vtiger CRM and Bugzilla. It is very critical that you must be doing backups for your MySQL Databases. When I started, I wrote a simple and yet pretty much effective bash script to automate and schedule that backing up procedures. It has been serving me quite nicely for now.

Basically, I needed to make a dump of MySQL Database, name it with today’s date, gzip and ftp to a different backup server. Of course I used crontabs to schedule backups.

Read the rest of this entry »

Written by Arstan

April 26th, 2007 at 12:13 am

Posted in Linux, Programming