Showing posts with label script. Show all posts
Showing posts with label script. Show all posts
Error: SoftException in Application.cpp:303 UID of script is small than min_uid
Posted by Unknown at 01:00 0 comments
If you see the below error in your logs then that means that the script is owned by a user (generally root) instead of the actual user.
SoftException in Application.cpp:303: UID of script "/location/path/.php" is smaller than min_uid
You can receive similar error when you have a wrong group name, in this case instead of UID, you will have GID in the error.
To fix this issue, make sure you have correct user and group ownership for the file that you are trying to access. Ownership can be changed using the below:
# chown usernmame:groupname filename.php
SoftException in Application.cpp:303: UID of script "/location/path/.php" is smaller than min_uid
You can receive similar error when you have a wrong group name, in this case instead of UID, you will have GID in the error.
To fix this issue, make sure you have correct user and group ownership for the file that you are trying to access. Ownership can be changed using the below:
# chown usernmame:groupname filename.php
Shell Script To Auto Restart Apache HTTPD When it Goes Down
Posted by Unknown at 23:13 0 comments
This is a simple shell script tested on CentOS / RHEL / Fedora / Debian / Ubuntu Linux. Should work under any other UNIX liker operating system. It will check for httpd pid using pgrep command
Download the script and set cronjob as follows:
*/5 * * * * /path/to/script.sh >/dev/null 2>&1
Sample script
Download the script and set cronjob as follows:
*/5 * * * * /path/to/script.sh >/dev/null 2>&1
Sample script
#!/bin/bash
# Apache Process Monitor
# Restart Apache Web Server When It Goes Down
# -------------------------------------------------------------------------
# Copyright (c) 2003 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# RHEL / CentOS / Fedora Linux restart command
RESTART="/sbin/service httpd restart"
# uncomment if you are using Debian / Ubuntu Linux
#RESTART="/etc/init.d/apache2 restart"
#path to pgrep command
PGREP="/usr/bin/pgrep"
# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
HTTPD="httpd"
# find httpd pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if apache not running
then
# restart apache
$RESTART
Shell script to restart MySQL server if it is killed or not working
Posted by Unknown at 23:15 0 comments#!/bin/bash
# Shell script to restart MySQL server if it is killed or not working
# due to ANY causes.
# When script detects mysql is not running (it basically sends ping request
# to MySQL) it try to start using /etc/init.d/mysql script; and it sends an
# email to user indicating the status.
# This script must be run from Cron Job so that it can monitor mysql server.
# For more info visit following url:
# http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/08/linux-mysql-server-monitoring.html
# --------------------------------------------------------------------------
# Copyright (C) 2005 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
# mysql root/admin username
MUSER="root"
# mysql admin/root password
MPASS="SET-ROOT-PASSWORD"
# mysql server hostname
MHOST="localhost"
#Shell script to start MySQL server i.e. path to MySQL daemon start/stop script.
# Debain uses following script, need to setup this according to your UNIX/Linux/BSD OS.
MSTART="/etc/init.d/mysql start"
# Email ID to send notification
EMAILID="notification@somewhere-corp.com"
# path to mail program
MAILCMD="$(which mail)"
# path mysqladmin
MADMIN="$(which mysqladmin)"
#### DO NOT CHANGE anything BELOW ####
MAILMESSAGE="/tmp/mysql.fail.$$"
# see if MySQL server is alive or not
# 2&1 could be better but i would like to keep it simple and easy to
# understand stuff :)
$MADMIN -h $MHOST -u $MUSER -p${MPASS} ping 2>/dev/null 1>/dev/null
if [ $? -ne 0 ]; then
echo "" >$MAILMESSAGE
echo "Error: MySQL Server is not running/responding ping request">>$MAILMESSAGE
echo "Hostname: $(hostname)" >>$MAILMESSAGE
echo "Date & Time: $(date)" >>$MAILMESSAGE
# try to start mysql
$MSTART>/dev/null
# see if it is started or not
o=$(ps cax | grep -c ' mysqld$')
if [ $o -eq 1 ]; then
sMess="MySQL Server MySQL server successfully restarted"
else
sMess="MySQL server FAILED to restart"
fi
# Email status too
echo "Current Status: $sMess" >>$MAILMESSAGE
echo "" >>$MAILMESSAGE
echo "*** This email generated by $(basename $0) shell script ***" >>$MAILMESSAGE
echo "*** Please don't reply this email, this is just notification email ***" >>$MAILMESSAGE
# send email
$MAILCMD -s "MySQL server" $EMAILID < $MAILMESSAGE
else # MySQL is running :) and do nothing
:
fi
# remove file
rm -f $MAILMESSAGE
ionCube autoinstaller script
Posted by Unknown at 18:56 0 commentsionCube php loader is the PHP extension that decodes encrypted PHP files on runtime, usually this is already installed on any web server whether it be used for shared hosting, reseller hosting or on your dedicated web servers.
If for some reason you don’t have it installed on your linux server, you can use the below shell script created by one of our system administrator.
Create a file named ioncubeinstaller.sh and paste the below code in the file:
#!/bin/bash
# Supportfacility.com
WHO=$(whoami)
if [ ${WHO} == "root" ]
then
echo “Script Initialized …”
else
echo “You must be logged in as root to install ionCube Loader.”
echo “Terminating …”
exit 0
fi
echo “Changing directory”
cd /usr/local/
echo “Done.”
if [ -e ioncube_loaders_lin_x86.tar.gz ]
then
rm -f ioncube_loaders_lin_x86.tar.gz
fi
echo “Downloading files”
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
echo “Done.”
echo “Installing files”
tar -zxvf ioncube_loaders_lin_x86.tar.gz
echo “Done.”
echo “Changing ownership”
chown -R root.root ioncube
echo “Done.”
phpline=`php -v | grep ^PHP | cut -f2 -d ” “| awk -F “.” ‘{print “zend_extension=\”/usr/local/ioncube/ioncube_loader_lin_”$1?.”$2?.so\”"}’`
phpinifile=`php -i | grep php.ini | grep ^Configuration | cut -f6 -d” “`
echo “Adding line $phpline to file $phpinifile”
echo “$phpline” >> $phpinifile
rm -f ioncube_loaders_lin_x86.tar.gz
echo “Ioncube installed sucessfully”
Then, change the permissions of the file to 755
root# chmod 755 ioncubeinstaller.sh
And execute it with
root# ./ioncubeinstaller.sh
This has been tested on cPanel, Plesk, DirectAdmin dedicated servers and will work on any linux server
Let us know if this script was helpful for you.
Subscribe to:
Posts (Atom)