script to test php.info

<?php
include("config.php");
mysql_connect("$dbhost", "$dbuname", "$dbpass");
mysql_select_db("$dbname");
echo mysql_error();
phpinfo();
?>


--

shell scripting tip

suppose you want to write a script to install postfix-mysql package ( example ) and youdonot want intruption while the scripts executes you add the -y switch to the apt-get command.

#!/bin/sh

echo "this is a script tp install postfix fro virtual domains "

apt-get install -y postfix-mysql

or you can also try

#!/bin/sh echo "this is a script tp install postfix fro virtual domains " #apt-get install -y postfix-mysqlapt-get install postfix-mysql <<>

y

END

if you wan to install many packages ( put in loop )

#!/bin/sh

echo "this is a script tp install postfix fro virtual domains "

for package in package1 package2 package3

do apt-get install $package <<>

y

END

done

hope this helps you!!!!

Installing a DNS server on debian etch

apt-get install bind9
 
vi /etc/bind/named.conf.local
 
add the following
 
zone "test-server.com" IN {
        type master;
        file "/etc/bind/test-server.db";
        };
 
 
 vi /etc/bind/test-server.db
 
add the following

$TTL 86400
$ORIGIN test-server.com.
@       IN      SOA     ns1.test-server.com. admin.test-server.com. (
                                                2004042601      ; serial
                                                21600           ; refresh
                                                3600            ; retry
                                                604800          ; expires
                                                86400 )         ; minimum

        IN      NS              ns1.test-server.com.

        IN      MX      10      mail.test-server.com.

        IN      A               192.168.0.242

ns1     IN      A       192.168.0.242
www     IN      A       192.168.0.247
ftp     IN      A       192.168.0.247
mail    IN      A       192.168.0.244
aggi    IN      A       192.168.0.247


vi /etc/resolv.conf
nameserver 127.0.0.1
 
/etc/init.d/bind reload
 
on other clients
vi /etc/resolv.conf
nameserver 192.168.0.242
 
now do a

--

manipulating commands using keyboard maps

The inputrc file handles keyboard mapping for specific situations. This file is the startup file used by Readline — the input-related library — used by Bash and most other shells.

suppose you want to run a command witha specific keystroke eg : ctl+e to give the out put ls -la
 
you will need to append the following to the /etc/inputrc file
 
Control-e: "ls -la\n"
 
save the file
 
bind -f /etc/inputrc ------------> to the the changes may be relflected

now try to do a control +e and theout put on the screen will be a ls -la
 
--

good linux resource LFS

http://lfs-matrix.net/clfs/view/clfs-2.0/arm/index.html

--

Good linux resources

http://www.jpsdomain.org/linux/linux.html

--

Making Your Prompt More Informative

Setting a particular parameter is as simple as typing VARIABLE=value . This would set a parameter by the name VARIABLE with the value that you provide.

To see a list of the environment variables that are already set on your machine, type the following

$ env

Many prompts do not include the return code of the last command. Although such information is not completely necessary, it might help you see whether a previous command succeeded or failed. So, a simple, informative prompt that is easy to read can be set as follows (in the bash shell):

export PS1="-$?-(\u@\h) \w --> "

$? : this willgive you the return code wheather the previous command executed successfully

\w: This special sequence expands to your full current working directory. \n : can add this to the PS1 vairable ..... this takes you to the next line .

[ note: the export command sets a enviroment virable ]

you can also check inthe home dir of root ( ~ ) .bashrc file and make changes to the PS1 vairables there

--

steps to create password-less login

On the host machines create a private and a public key pair
 
ssh-keygen -t rsa 2048
 
[this will create a ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub for the private and public keys, respectively ]
 
now copy the ~/.ssh/id_rsa.pub to the remoate system where you want passwordless login
 
scp ~/.ssh/id_rsa.pub root@192.168.0.247:/tmp

Now on the remote machine

mkdir ~/.ssh
chmod 700 ~/.ssh
cp /tmp/id_rsa.pub ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

now on the host machine try to login iin , it shold log you in woith outh a password
You can append as many public keys  usig the >> sign

--

ssh for system admainistrators

ssh root@ipaddress command ---------> will display the command to you of the remote pC

secured copy

scp local_file root@192.168.0.244:/tmp/remote_file ----> copies the file ( local_file)  to remote location

scp root@192.168.0.244:/tmp/remote_file loca_files ---> copies remote files to local machine

scp root@192.168.0.234:file1 name root@192.168.0.244: ----- will copy file1 frm the home dir of 192.168.0.234 to the home dir of 192.168.0.244



--

Other Articles

Enter your email address: