Home » Programing

Adding custom body classes to the standard Drupal output

Here’s a great trick if you need to add custom classes to the body tag output of your Drupal theme. This goes above the standard body tag output using a line like this in your page.tpl.php <body class=”<?php print $body_classes; ?>”> Which only creates the usual body classes like: <body class=”front logged-in page-node one-sidebar sidebar-right”> [...]

Shell script to find all programs and scripts with setgid bit set on

setuid and setgid (short for set user ID upon execution and set group ID upon execution, respectively) are Unix access rights flags that allow users to run an executable with the permissions of the executable’s owner or group. They are often used to allow users on a computer system to run programs with temporarily elevated [...]

Script to email failed Ftp login attempts

Shell Script to search Failed Ftp Login Attempts This Shell script will search the server logs on daily basis and will email you the Failed Ftp Login Attempts of the day. The ftp logs are saved in the /var/log/messages file as by default there is no separate log file for Ftp in Linux. Create a [...]

Number of exim connections

tail -1000 /var/log/exim_mainlog |grep ‘\[' |cut -d[ -f2 |cut -d] -f1|sort -n |uniq -c |sort -n Incoming search terms:cpanel shell scripts (3)shell script to send email on daily basis (1)

Shell script to Finding ALL Superuser ( root ) Accounts under UNIX / Linux OSes

In Unix-style computer operating systems, root is the conventional name of the user who has all rights or permissions in all modes (single- or multi-user). The root user can do many things an ordinary user cannot, such as changing the ownership of files and binding to ports numbered below 1024. It is never good practice [...]

Shell script to create list of backup files in ~/.mybackup file. Use with mybackup shell script

#!/bin/bash # mybackupadd – Add file to ~/.mybackup file, then backup and email all # file as tar.gz to your email a/c. # # Usage : ./mybackupadd ~/public_html/ # # Copyright (C) 2004 nixCraft project # Email : http://cyberciti.biz/fb/ # Date : Aug-2004 # ————————————————————————- # This program is free software; you can redistribute it [...]

Shell script to backup directories from Linux server to Windows 2000/NT Server

#!/bin/bash # Shell script to backup directories from Linux server to Windows 2000/NT Server. # Run it as follows # Scriptname /home backup abc123 //server2000/backup # Backup /home directory from Linux box to NT/2000 box called # ‘server2000′ in share called ‘/backup’ with username # ‘backup’ and password ‘abc123′ # ——————————————————————– # This is a [...]

Shell Script for Disk Space Notification

Shell Script for Disk Space Notification The Disk Space Notification script can be scheduled to run once in a week which will check the Disk Space Usage on the server. The Shell script will send out an email to the admin if the Disk Space Usage is greater than the Threshold. Create a file /home/diskspace.sh [...]

Shell script to backup MySql database

#!/bin/bash # Shell script to backup MySql database # To backup Nysql databases file to /backup dir and later pick up by your # script. You can skip few databases from backup too. # ——————————————————————– # This is a free shell script under GNU GPL version 2.0 or above # Copyright (C) 2004, 2005 nixCraft [...]

Shell Arithmetic

Use to perform arithmetic operations. Syntax: expr op1 math-operator op2 Examples: $ expr 1 + 3 $ expr 2 – 1 $ expr 10 / 2 $ expr 20 % 3 $ expr 10 \* 3 $ echo `expr 6 + 3` Note: expr 20 %3 – Remainder read as 20 mod 3 and remainder [...]