Connect with us


Script for taking webthumb using html2image tool




#cd /opt


#tar xvzf html2image.i386.tar.gz

#cd html2image

#export LD_LIBRARY_PATH=./

Save the shell script without sh extension in /opt/websnap

file name


#cd /opt/html2image



./Xvfb :1 -screen 0 1024x768x24 -nolisten tcp -audit 4 -auth X1.cfg & export DISPLAY=:1

./html2image $1 /home/test/public_html/$2

echo “html 2 image Done!”

Save the php script script wherever u want

PHP script (web_snap.php)

exec(“export LD_LIBRARY_PATH=/opt/”); // if html2image folder in /opt folder

// here html_2_image is above shell script

exec(“/opt/websnap google.png”, $result, $returnValue);


Execute “web_snap.php” with cron job, the result image will saved to “/home/siteroot /public_html/html2image/” folder.

Continue Reading


Screen command Utilities




Screen command tips

Screen is a full-screen window manager for the terminal mode. It is best known for multiplexing a single terminal across several processes. By using it, you can run many number of commands within a single terminal.

1) First open a terminal and type :

$ screen

2) Screen starts and creates a new single window with a shell.

New windows can be created within the same terminal using the screen command.

3) Now you started screen in a terminal, suppose you want to run the ‘top’ command to check the System load and at the same time you want to ping a ip –

For that, first execute the first program to be run (say ‘top’). now ‘top’ will start in the terminal.
Now open a new window in screen by pressing the ‘[Ctrl + a] c’ – which I will state as ‘C-a c’ . This will create a new window in the same terminal. Here, you can give commands to compile your program.
In screen, each window is given a unique identifier. The first window is numbered 0, the next window is 1 and so on. Now to switch between your ‘top’ and the ping, you can use the key ‘Ctr+a 0′ and ‘Ctrl+a 1′ respectively.

You can also log out from the machine and re-login. Then start any terminal session and type ‘screen -r’ to once again be connected from where you left.
In case, there were more than one screen sessions running on the machine, Screen prompts for a
For example, say I have two screen sessions. So when I type ‘screen -r’ command, it gives the following message:

$ screen -r
There are several suitable screens on:
2999.pts-6.localhost (Detached)
1920.PTS-6.localhost (Detached)
Type “screen [-d] -r [pid]” to resume one of them.

Continue Reading


Configuring Apache log files




Apache Logs:

The Logs of Apache server is more useful to maintain the webserver effectively. usually we have 2 kinds of logs that is access log and error log.Error logs are very useful for troubleshooting process.

Some important logging Directives of Apache


* Errorlog —> It Defines the file path to which the error logs of the server are to be store


ErrorLog file-path|syslog[:facility]

Their is two different method to mention the error log file in apache. By default the ErrorLog directive will be appear as

ErrorLog logs/error_log          // here the file path is given as relative path to the                                                                      server root

we can change the error log file path as user defined

Method 1

Example:    ErrorLog /var/log/httpd/error_log

In the above example the file-path of error log is given as absolute path as user defined.
If the error log file path is start with a pipe symbol “|” means then it consider as a command to generate and handle the error log. for example

ErrorLog  ”|/usr/sbin/rotatelogs /var/log/httpd/error_log 100M “

In the above example the rotatelogs command which comes after the pipe symbol will handle the error log file by rotating the error log if it reach’s the 100 MB in size.

Method 2

Instead of using file name in ErrorLog directive using syslog will enable the logging in apache

Example:       ErrorLog “syslog:user”

while using syslogd you need to put the user name and log file path in /etc/syslog.conf file and kindly restart the syslog service

* LogLevel —> It Controls the verbosity or no of messages to be logged in error log file.

Loglevel level

The available loglevels are

emerg —> It means the emergency, server is not available ex: (28)No space left on                          device:

warn —> This is for Warning type of alert ex: child process 29960 still did not exit,                            sending a SIGTERM

error —> It specify the scripting errors ex: file does not exist

info —> information from server to the admin ex: server reached max clients

notice —> some Significant condition like service restarting

debug —> Debug level Messages like opening of config file

crit —> This is for critical condition ex: configuration error: couldn’t check user.

alert —> This for alert to take action immediately ex:getpwuid: couldn’t determine user                   name from uid

The default log level in apache is warn.

*LogFormat —> It will specify the access logformat, we can modify as per our needs


LogFormat “format” name

By Default the Log format in apache configuration file looks like as below

LogFormat “%h %l %u %t \”%r\” %>s %b”

The LogFormat directive gives logging format for access log, we can define the Logformat as per our needs.


LogFormat “%h %l %u %t %r %s %b %{Referer}i \”%{User-Agent}i\”” combined
CustomLog logs/access_log combined

In this example the log format defined as per the user needs and a nick name combined is given to the format which is used in CustomLog Directives as showned in above example

where h-host or IP , l-Client Identity , u-client username if have HTTP authentication , t-time and date ,r-Request content(requested page) , s-response code for the request , b-size of the data return to the client in bytes,i- User info like accessed url, browser, os etc

* CustomLog —> It logs the client request information on the server in the given                                           location

CustomLog file|pipe format|nickname [env=[!]environment-variable]

In syntax first argument (file) is the location of the log, pipe is already seen in ErrorLog and 2nd argument is nickname mentioned in logformat, we can mention logformat here also, and the third argument is optional Which is used to record the particular log in separate file like logging request for gif images alone, It will be done by using SetEnvIf directive

Example:     CustomLog logs/access_log combined

The above example shows the reative path of access log file and combined is the log format nick name as mentioned earlier in Logformat Directive. we can also give user defined absolute path to the access log as like below

CustomLog /var/log/httpd/access_log combined

This shows the absolute path of the access log file.

* PidFile —> To Specify the location to store the process id of the Deamon

Syntax: PidFile filename

The default pid file in apache is mentioned as

PidFile logs/

This file stores the process id of our apache service .


PidFile /var/run/

In this example we changed the pid file path as per our wish.

Continue Reading


How to run a script every second




cat >
while [ 1 ];
echo “Welcome Rajkumar” >> /home/rajm/script/test
sleep 1;

Save the file

#chmod +x
#sh &

#tailf  /home/rajm/script/test
Welcome Rajkumar
Welcome Rajkumar
Welcome Rajkumar

Continue Reading


Copyright © 2022 VX SEO. developed by Imran Javed Awan.