Skip to main content

Posts

Limit the minute cron to minimum 15 minutes

#!/bin/bash ls -1 /var/spool/cron/| grep -v '^root'|while read u; do         cat /var/spool/cron/${u}|\         awk '{print $1":"$2":"$3":"$4":"$5":"$NF}'|\         while read entry;         do                 mn=$(echo ${entry}|awk -F':' '{print $1}');                 if [[ ${mn} == "*" || ${mn} =~ "\*\/[0-14]$" ]];                 then                         echo "Minutely script found -> ${u}";                  ...

Ghost CMS installation

 yum install nodejs npm --enablerepo=epel  curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip unzip -uo ghost.zip -d  /home/user/public_html cd /home/user/public_html  npm start --production  http:// :2368 Adding proxy in apache virtual host     ProxyRequests off     ProxyPass / http://127.0.0.1:2368/ To run ghost forever  cd /path/to/ghost/folder sudo npm install -g pm2 echo "export NODE_ENV=production" >> ~/.profile source ~/.profile pm2 kill pm2 start index.js --name ghost ┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬────────────┬──────────┐ │ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory     │ watching │ ├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼────────────┼──────────┤ │ ghost    │ 0  │ fork │ 15823 │ online │ 1       │ 0s     │ 7.953 ...

Procmail to execute a script and redirect mail to SPAMCOP

yum install procmail ls /usr/bin/procmail /usr/bin/procmail* cat /home/user/.procmailrc #Whatever recipes you'll use #The order of the recipes is significant :0 | /home/username/mime.sh in filter you can set rules to pipe  ##Rule3 if  $h_X-Spam-Status: begins "Yes" then  pipe "/usr/bin/procmail -Y -a /home/user/.procmailrc" endif  mime.sh #!/bin/sh # ENTER PATH OF THE EMAILS THAT ARE TO BE SUBMITTED TO SPAMCOP FPATH="/home/user/mail/domain/spam-redirect-test/cur/" FPATH2="/home/user/mail/domain/spam-redirect-test/new/" # ENTER YOUR SPAMCOP EMAIL ADDRESS EMAIL="quick.*******@spam.spamcop.net" ################################################################# ################################################################# cd $FPATH for FILENAME in * do         # Create email and submit it to the supplied spamcop address         /usr/local/bin/mime-construct \   ...

Changing PHP in FCGI, SUPHP, and CGI

CGI ======== # CGI configuration for PHP5 Action application/x-httpd-php5 /cgi-sys/php5 AddType application/x-httpd-php5 .php5 .php .php3 .php2 .phtml FCGI ======= FCGIWrapper /home/usernam/php-cgi .php Suphp ========= in premain2.conf Allow from All    suPHP_AddHandler application/x-httpd-php5.3        AddType application/x-httpd-php5.3 .php

Secure SSL

openssl  ./config --prefix=/usr/local/newopenssl  curl ssl ./configure --prefix=/opt/curlssl --with-ssl=/usr/local/newopenssl --enable-http --enable-ftp LDFLAGS=-L/usr/local/newopenssl/lib CPPFLAGS=-I/usr/local/newopenssl/include root@server [~]# cat /var/cpanel/easy/apache/rawopts/Apache2_4 --with-ssl=/usr/local/newopenssl/bin LDFLAGS=-L/usr/local/newopenssl/lib CPPFLAGS=-I/usr/local/newopenssl/include root@server [~]# cat /var/cpanel/easy/apache/rawopts/all_php5 --with-openssl=/usr/local/newopenssl --with-curl=/opt/curlssl whm>apache configuration> global  cipher suite  ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-R...

SOME ROUTING INFO AND NETWORKING

NETWORK LAYERS Application eg.ssh Transport  UDP,TCP Internet     Packets Link          Ethernet *)  To show up all interface and info execute ip addr show ---------------------------------- rahul@rahul-Inspiron-3542:~$ ip addr show 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00     inet 127.0.0.1/8 scope host lo        valid_lft forever preferred_lft forever     inet6 ::1/128 scope host        valid_lft forever preferred_lft forever 2: enp7s0: mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000     link/ether 74:e6:e2:00:24:53 brd ff:ff:ff:ff:ff:ff ---------------------------------- *) To show information about an interface execute ip -s link show l0 ---------------------------------- rahul@rahul-Inspiron-3542:~$ ip -s link show lo 1: lo: mtu 65536 ...

RAID

Check the Raid installed lspci | grep RAID     Software Raid ============== Linux Support For Software RAID Currently, Linux supports the following RAID levels (quoting from the man page): LINEAR RAID0 (striping) RAID1 (mirroring) RAID4 RAID5 RAID6 RAID10 MULTIPATH, and FAULTY. MULTIPATH is not a Software RAID mechanism, but does involve multiple devices: each device is a path to one common physical storage device. FAULTY is also not true RAID, and it only involves one device. It provides a layer over a true device that can be used to inject faults. Install mdadm Type the following command under RHEL / CentOS / Fedora Linux: # yum install mdadm Type the following command under Debian / Ubuntu Linux: # apt-get update && apt-get install mdadm How Do I Create RAID1 Using mdadm? Type the following command to create RAID1 using /dev/sdc1 and /dev/sdd1 (20GB size each). First run fdisk on /dev/sdc and /dev/sdd with " Softwa...