Archive for the tag 'Script'

Debugging on part(s) of the bash script

Using the set Bash built-in you can run in normal mode those portions of the script of which you are sure they are without fault, and display debugging information only for troublesome zones. Say we are not sure what the w command will do in the example commented-script1.sh, then we could enclose it in the script like this.

set -x # activate debugging from here
w
set +x # stop debugging from here

You can switch debugging mode on and off as many times as you want within the same script.

SBDavid

Cloudmin Installer Script

Cloudmin Installer Script

Supported Linux distributions are CentOS 5, Redhat Enterprise 5, Debian 4.0 and Ubuntu 8.04.

The CentOS or Redhat installer can be downloaded from:
http://cloudmin.virtualmin.com/gpl/scripts/cloudmin-gpl-redhat-install.sh

Once you have it on the Linux system you want to run Cloudmin on, execute it with the commands

chmod +x cloudmin-gpl-redhat-install.sh
./cloudmin-gpl-redhat-install.sh

The install script should download and setup a Xen-capable kernel.

Enable ImageMagick perl module for perl/cgi script.

1. Install ImageMagick-perl package corresponding to ImageMagick rpm installed on the server shipped by OS vendor.

e.g.

# rpm -q ImageMagick
ImageMagick-6.0.7.1-12
#rpm -ivh ImageMagick-perl-6.0.7.1-12.i386.rpm

OR

1. You can use up2date or yum to install/upgrade ImageMagick-perl package

# up2date ImageMagick-perl

or

#yum install ImageMagick-perl

2. Run ensim through maintenance mode.

set_pre_maintenance
set_maintenance
set_post_maintenance
service webppliance restart

Reference: http://parallels.com

SBDavid

Running CGI script from any directory

Running CGI script from any directory

In order to force apache to allow cgi script to run, simply create a file called .htaccess inside the directory in which you wish to run the scripts. Inser this text into the file:

AddHandler cgi-script .cgi .pl

AddHandler maps the filename extensions extension to the handler handler-name. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. For example, to activate CGI scripts with the file extension “.cgi”, you might use:

AddHandler cgi-script .cgi

Once that has been put into your srm.conf or httpd.conf file, any file containing the “.cgi” extension will be treated as a CGI program.

The extension argument is case-insensitive, and can be specified with or without a leading dot.

PHP as a CGI script with suexec

For hosts running PHP as a CGI script with suexec you may be able to put these directives in a php.ini file in your website root directory.

upload_max_filesize = 10M
post_max_size = 20M

Add the below to your .htaccess file in your web root directory.

php_value upload_max_filesize 10M
php_value post_max_size 20M

The PHP documentation states that the memory_limit setting also affects file uploading.
Generally speaking, memory_limit should be larger than post_max_size.

Depending on your host, this can be done in a number of places with the most likely being php.ini or .htaccess depending on your hosting situation.

Add for example:

memory_limit = 16M to your php.ini file (recommended, if you have access)

With root access, you can use the sed util in Linux/Unix based systems, in order to increace the memory for 64M. Don’t forget to properly locate you php.ini file!

sed -i ’s/memory_limit = 16M/memory_limit = 64M/’ /etc/php5/apache2/php.ini

« Prev - Next »