web analytics

Monthly Archives March 2012

Ubuntu Error: “No init found. Try passing init= bootarg”

It was my work time and I was all set to login. I logged in to my ubuntu 10.04 and took the applications one by one and soon the machine was all stuck. I waited some time to see if it corrects itself, but there was no luck. I then rebooted the machine and thought of taking everything again. To my surprise and making me tensed, was a black screen with the following error.

mount: mounting /dev/disk/by-uuid/***************************** on /root
failed: Invalid argument
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
Target file system doesn’t have /sbin/init
No init f...

Read More

Login to website using curl

Suppose there is a domain  divya.com which has a login form. You need to login to the site every hour, to make sure that the login is working. For that the following script helps, which can be run as a cron.


#!/bin/sh
cd /root/test/abc/
> cjar
> test2.txt
> test3.txt
##Cookies will be stored in the file cjar##
curl –cookie-jar cjar –data “username=abc@gmail.com&password=12345” –location “http://abc.com/login/” > test2.txt

##Specify the cookie file and access another link to see if it works. If login works, you will get the code of this page, otherwise it will get redirected to the login page itself, returning a 302 status code##


curl -b cjar http://abc.com/save_org > test3.txt

CODE=$(grep -o “302 – Found” test3.txt)
if [ “$CODE” == “302 – Found” ]
then
echo “abc...

Read More

Changing root email recipient in postifx

You can change the recipient to whom the root mails from server are delivered as follows.

1) Go to /etc/aliases

2) Scroll down to the bottom where you will find a line as follows.

# Person who should get root’s mail
root: mark

If you want to send this to some other email address, say mark@gmail.com, make the line looks as follows.

# Person who should get root’s mail
root:  mark@gmail.com

Once the change is done, save and close the file. In order for the changes to be picked up by postfix, you need to issue the following command.

# newaliases

 

Once that is done, try sending a mail to the root ID and see how it goes !!

 

Read More

CHECK_NRPE: Error – Could not complete SSL handshake

While configuring and testing nagios monitoring, you may sometimes get the above error. Then check for the following.

In the remote server being monitored,

1) Check the file /etc/xinetd.d/nrpe. Make sure that the only_from field contains the nagios server IP, which is shown as x.x.x.x below.

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1 x.x.x.x
}
2) In the remote server being monitored, make sure that the nagios IP is added to the allowed_hosts section of the file /usr/local/nagios/libexec/nrpe.cfg

allowed_hosts=127.0.0...

Read More