nav-left cat-right
cat-right

Linux: Monitor your mount points to see if they go...

This bash script should be helpful to you if your partitions go to read-only mode frequently. This script will check if any of your partition is in read-only mode. If yes, it will remount into read-write mode. You will be alerted via email if the remount fails. You can download the script from here. #! /bin/bash ############################################################################ # Check if the filesystem/partition...

Delete lines between two matching patterns...

Do you want to remove everything in between two matching patterns? Here is a bash script to do that. You can define the patterns in the variables PATRN_START and PATRN_END. The output will be printed to standard output (shell prompt). You can download the script from here. #! /bin/bash ######################################################################################### #            ...

Linux: Timestamp conversion methods...

A timestamp is a sequence of characters, denoting the date and/or time at which a certain event occurred. This data is usually presented in a consistent format, allowing for easy comparison of two different records and tracking progress over time. Unix timestamp is defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds. The Unix epoch is...

Bash script to validate your IP address format...

Here is a bash script to validate your input/output IP address format. This script simply checks if there are four fields separated by dots (periods) and if the values are less than 256. You can download the script from here. #! /bin/bash ######################################################################### #                                ...

C Program to setuid to root user (run programs own...

Sometimes you will need to permit normal users to run programs that are owned by other users (or root). Suppose, you have some important data under root’s ownership and you don’t want the users to read/modify them. But, users require them during their daily works. In such situation, you can make use of this program. This program will call the shell script /root/scured/scripts/exec.sh which inturn will run...

A bash script for ping test...

Here is a simple bash script to ping multiple hosts at a time. It’s a very simple and might not be useful always. I just wrote this when I wanted to test hundreds of IP addresses by ping. # Usage: pingtest 192.168.1.0/24 # pingtest 192.168.1.0-255 You can download the script from here. #! /bin/bash ######################################################################### #      ...

PHP script to test mysql connection...

Here is a simple PHP script to test your mysql connection from webserver. You can download the script from here. ~mohammed

Bash script to check uptime of any service...

Do you want to know uptime of any service in Linux? Checkout the script available here. #! /bin/bash ################################################################# #                                                               # # A simple bash script to print...

Plesk restore: Restore domains from old hard drive...

The operating system must be reloaded onto a separate disk, which will become the primary, and old disk can be mounted as a different mount point like /restore. Plesk actually has a nice migration tool (PleskX.pl), and as such, a disk to disk-based migration is easy to accomplish. The following steps can be used: 1. Mount the old drive, for example to the /restore directory. If there are several partitions on the old...

Add a range of IP addresses simultaneously...

For a small range of IP addresses, you can manually add each of them to a file named ifcfg-eth0:x under /etc/sysconfig/network-scripts/. For example, if you want to add 4 IP addresses, you can create 4 files under /etc/sysconfig/network-scripts/ like ifcfg-eth0:0, ifcfg-eth0:1 etc. Each of them will contain something like this: DEVICE=eth0:0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.0.2 NETMASK=255.255.255.252 TYPE=Ethernet But,...

« Previous Entries