Tuesday, July 06, 2010

Setting DNS server on Amazon EC2

Setting up bind9 DNS server on Amazon EC2 today tough me that Amazon`s built in service definition in security group only includes TCP. be sure to open UDP port 53 as well for your server to function properly.

Provided by:SiQ systems, Cloud experts

Sunday, May 24, 2009

Searching for a pattern string under a directory

In order to search for a pattern string in all files under a specific directory you can use following command:
find $dir -exec grep $pattern {} \; -print
just replace $dir with the directory you want to start searching in and $patter with patter you are searching for.
for example:
find /etc -exec grep support {} \; -print

Saturday, May 09, 2009

changing editor in ubuntu linux

To permanently change editor in Linux do following:
edit your shell configuration file,
for example, bash configuration file is ~/.bashrc
To set editor as VI:
export VISUAL=vi
or to set nano:
export VISUAL=nano
to start it run:
source ~/.bashrc

Sunday, April 12, 2009

Running manual NTP (network time protocol) In Ubuntu Linux

If your Ubuntu is out of time sync you can run a manual comand to syncronize the clock. command is:
ntpdate
Running ntpdate with no options / switches will couse it to try to sync with default servers. If none are set you will get an error similar to:
ntpdate[15110]: no servers can be used, exiting
then run it with servers address.
for example:
ntpdate europe.pool.ntp.org north-america.pool.ntp.org
you might need to run sudo if you are not system root:
sudo ntpdate europe.pool.ntp.org north-america.pool.ntp.org
P.S. Server pool for Israel is:
il.pool.ntp.org

Provided by:SiQ systems, Cloud experts

Monday, April 06, 2009

Fix (repair) MySQL replication in case of duplicate items

If you as i am using MySQL replication mechanism, master-slave or master-master replication you sometimes loose replication due to duplicate entries.

You can fix it by simply skipping the record:
1. log into MySQL:
mysql -u root -p
2. in MySQL shell stop slave replication
mysql> STOP SLAVE;
3. skip the affected record
mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
4. start slave replication process
mysql> START SLAVE;
5. verify that replication is working:
mysql> SHOW SLAVE STATUS \G
6. exit MySQL shell:
mysql> quit;


Provided by:SiQ systems, Cloud experts

Wednesday, November 26, 2008

MySQL and debian-sys-maint account

If for some reason your debian-sys-maint account is unset in MySQL, during MySQL start you will have connect to server error. You might need to set this account in the MySQL server itself.
cat /etc/mysql/debian.cnf to get the password value from the file.
Then connect to the DB
mysql -u root -p
and execute:
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD' WITH GRANT OPTION

Monday, November 10, 2008

Changing time on CentOS

just copy relevant timezone file from /usr/share/zoneinfo to /etc/localtime

like:
cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime

Tuesday, July 15, 2008

unix backup with tar and mt

Rewind tape drive:# mt -f /dev/st0 rewind
Backup directory /www and /home with tar command (z - compressed):
# tar -czf /dev/st0 /www /home

Find out what block you are at with mt command:
# mt -f /dev/st0 tell

Display list of files on tape drive:
# tar -tzf /dev/st0

Restore /www directory:
# cd /
# mt -f /dev/st0 rewind
# tar -xzf /dev/st0 www

Unload the tape:
# mt -f /dev/st0 offline

Display status information about the tape unit:
# mt -f /dev/st0 status

Erase the tape:
# mt -f /dev/st0 erase
You can go BACKWARD or FORWARD on tape with mt command itself:
(a) Go to end of data:
# mt -f /dev/nst0 eod

(b) Goto previous record:
# mt -f /dev/nst0 bsfm 1
(c) Forward record:
# mt -f /dev/nst0 fsf 1

Thursday, July 10, 2008

deleting message from postfix queue

To list the queue execute:
mailq
You can find the problematic messages id and the execute:

find /var/spool/postfix -name "messegeID" | xargs rm

Sunday, October 14, 2007

InPlace CMS

New CMS release, InPlace, very simple to work with. It is a is a Python wrapper for XSLT. and of course freely distributed.
project`s homepage is here.
small flow diagram to make things simpler:



Why InPlace rocks? The documentation is already in the HTML form, no need for the generation step, no errors occur.

bmc configuration manager ( marimba ) cli runchannel return codes

those are CLI return codes for marimba runchannel on UNIX.
The return codes are 0, for success, and -1 through -12, for failure, as described below.
0 - runchannel -help was requested (and provided). A channel was started and completed an operation successfully.
1 - In the tuner's installation directory, the properties.txt file was missing from the lib/tuner/ directory. There was an incorrect runchannel command-line argument. An exception occurred while trying to start the tuner. There were notifications related to channel exceptions, RPC Disconnects, or RPC timeouts.
2 - An unexpected exception was caught. An associated stack trace gives more details. If you see this code while publishing a signed channel, then make sure that the cert DN (certificate's distinguished name) is specified correctly.
3 - Command was canceled.
4 - I/O error. Log entries should give more details, but this error can mean that the command failed to get data channel properties (that is, a communication problem between the endpoint and transmitter exists). This error can also mean that the command failed to move internal directories in or out during a publish or install operation.
5 - Publish error. A publish or unpublish command failed in the publish process. The actual error is described in the logs.
6 - Cleanup error. Not currently used.
7 - Update error. An install or uninstall command failed in the installation process. The actual error is described in the logs.
8 - Concurrency error. This error can occur only when the application is used as a library. The same instance of a kernel was used to perform multiple publish or installation commands simultaneously.
9 - Exec error. An error occurred while trying to execute a pre- or post- installation command.
10 - Unsigned error. Not currently used. Attempting to install a channel that is not properly signed returns a -3 (canceled) code, but a log entry indicating that the channel was not signed correctly also exists.
11 - Unknown error. This error should not be returned. If this error is returned, the logs contain entries indicating the problem.
12 - No-such-channel error. An error occurred while getting the data channel list from a transmitter. When installing, the data channel is what the application publishes to the transmitter during a publish command.

Provided by:SiQ systems, Cloud experts

how to restore system user in oracle and lock it back

Following instructions will help you unlock the oracle db system user and lock it back when needed.
Those are the instructions:
1) login to a machine as user oracle
2) connect to sqlplus: sqlplus '/ as sysdba'
3) unlock user: alter user system account unlock;
4) change password: alter user system identified by manager;
5) verify connection: conn system/manager
6) restore password: ALTER USER system IDENTIFIED BY VALUES 'F2B917B76C7DFF0A';
7) lock user: alter user system account lock;
8) verify lock: conn system/manager
you should see the following message: ERROR: ORA-28000: the account is locked

how to locate oracle SID on linux / unix machine

Log into a UNIX or Linux machine as root.
execute: ps -ef |grep -i pmon
you should see something like that:
oracle 27161 1 0 Mar07 ? 00:03:53 ora_pmon_ODS
then ODS is a SID of that oracle.

How to set or disable auto-logout on bash shell

Following information is intended for bash shell only.
The system variable TMOUT can be set to specify the amount of time the user is inactive before the user is automatically logged out.
Set the following listed below in the /root/.bashrc file: TMOUT=XXX #
The system will logout the root account after one hour of inactivity. The value entered for the TMOUT= variable is in seconds. To represent 1 hour, we have to multiply as follows: 1 hour is 60 minutes. 60 minutes * 60 seconds = 3600 seconds.
After setting the parameter, the intended user will need to log out and then log in for the changes to take effect. To make modifications apply to all users on the system, specify the TMOUT variable in /etc/ profile.
To disable auto-logout simply comment out or delete the line with TMOUT value

Provided by:Forthscale systems, cloud experts

small legato cluster commands guide

Just a small legato cluster (on Linux in my case) commands reference guide.

to list resources in legato cluster:
$FT_DIR/bin/ftcli -cmd lrg (lists the legato resource groups)
$FT_DIR/bin/ftcli -cmd lip (lists ip numbers in legato cluster)
$FT_DIR/bin/ftcli -cmd ln (lists legato cluster nodes)
$FT_DIR/bin/ftcli -cmd lp (lists all the processes in legato cluster)


to start a legato cluster resource group:
$FT_DIR/bin/ftcli -cmd "bgo resource_group_name node"
to stop a legato cluster resourse group:
$FT_DIR/bin/ftcli -cmd "tgo resource_group_name"

to start a legato cluster monitored application:
$FT_DIR/bin/ftcli -cmd "start application node"
to stop a legato cluster monitored application:
$FT_DIR/bin/ftcli -cmd "stop application"

Provided by:SiQ systems, Cloud experts

Sunday, December 03, 2006

double loop script example

#!/bin/bash

i=0
for ID1 in $(awk -F":" '{print $2}' /tmp/components) ; do
id1[$i]=$ID1
i=$(($i+1))
done
j=0 ; while [ $j -lt $i ] ; do cmvt_component_os=${id1[$j]}; echo $cmvt_component_os ; j=$(($j+1)) ; done

Thursday, January 19, 2006

just a nice transfer script

Following
#!/bin/bash
#
#
#

og_log_id=$1.log

function og_xml_upp_ftp {
ftp -n << EOF
open server
user (your user)" "
lcd (your directory)
bin
hash
put $og_log_id.gz
bye
EOF
rm (your directory)$og_log_id.gz
}

function og_logs_compess {
cp (your directory)$og_log_id /xtr/log_xfer
gzip /xtr/log_xfer/$og_log_id
}


case $1 in
'xml')
og_logs_compess
og_xml_upp_ftp
;;
'console')
og_logs_compess
og_xml_upp_ftp
;;
'both')
og_log_id=xml.log
og_logs_compess
og_xml_upp_ftp
og_log_id=console.log
og_logs_compess
og_xml_upp_ftp
;;

*)
echo "Usage: $0 (your text)"
exit 1
;;
esac

Tuesday, January 10, 2006

making php interface to webinject

I`m useing webinject to check our application simple web page screated to provide interface to connect the tool to our support web site. web form executes php script and php executes perl of webinject and returnes the result file.

relevant php code:



the sw script content:
/xtr/scripts/webinject/swa/webinject.pl -c naga_config_server_id.xml >> /var/log/og_in.log

The configuration xml of webinject is set to normal output wich is redirected to log file i rotate daily. that both prevents output being returned to php code and gives me operation log on the use of the system.

Thats it,
Feodor ( Naor ) Weissmann

Sunday, October 16, 2005

nagios plugin script for checking status of mirrored drives via nrpe.

Following script need to be defined in both nagios comamnds and nrpe agent on the client side

#!/bin/bash
# Copyright (c) 2005 Opengaming Israel, Naor Weissmann
# operations: check if all metastat unitx are operational.
#
RETSTR="initial"
RETVAL=0
youtput=`metastat |grep -i stat |grep 'State:' |grep -v 'Okay' |wc -l`

if [ $youtput -eq 0 ]; then
RETVAL=0
RETSTR="OK - All metadevices are stable"
else
RETVAL=2
RETSTR="ERROR - Metadevices need Maintainence"
fi

echo $RETSTR
exit $RETVAL

2026. What I Actually Do Now

It’s been over 20 years of on-and-off dumping into this blog. 27 and going years in tech, more than 10 years around AI, going back to Heili ...