Jun 16

written by MG \\ tags:

Jun 16

Some times, while scripting, you need to print a sequence of letters or numbers. Don’t write it yourself ! Bash it using seq or curly braces!

Some examples:

#seq 1 3

1
2
3

# seq -s : 1 10
1:2:3:4:5:6:7:8:9:10

# seq -s : 0 2 10
0:2:4:6:8:10

#echo {1..10}

1 2 3 4 5 6 7 8 9 10

# echo {a..z}
a b c d e f g h i j k l m n o p q r s t u v w x y z

Building some hash directories :

# mkdir -p test/{1..5}/{1..5}

 

written by MG \\ tags: ,

Jun 10

     One of Windows annoying so called “feature” is CHKDSK being automatically being run whenever you don’t shut down your computer properly. You get the blue colored screen that says “Checking file system on C: The type of the file system is NTFS. One of your disks needs to be checked for consistency. You may cancel the disk check, but it is strongly recommended that you continue. To skip disk checking, press any key within 10 seconds(s).

    Simply pressing any key would stop CHKDSK from running but when you restart your computer, you’ll get this prompt again. Sometimes even after letting CHKDSK scan the drive that it wants to, CHKDSK would still automatically run at next boot! Here’s how to disable or stop CHKDSK at Windows bootup.
    There are some people suggested to edit the registry but the proper way to disable CHKDSK from starting up is using the /x switch on chkntfs command in command prompt. The /x switch will exclude a drive from the default boot-time check. If you have drive C: as your hard drive, then the command to disable chkdsk from scanning C: drive would be:

chkntfs /x c:

If you have 2 drive, C and D, you can disable chkdsk with the command below:

chkntfs /x c: d:

written by MG \\ tags: ,

Jun 04

export IGNOREEOF=1

Result when press Ctrl+d :

Ctrl+d
# Use “logout” to leave the shell.
Ctrl+d
# exit

written by MG \\ tags: ,

Jun 03

1. First stop qmail: “qmailctl stop”

2. Go to /var/qmail/supervise/ and  copy entire smtp directory to smtp-ssl .

Edit /var/qmail/supervise/smtp-ssl/run by adding :

SMTPS=1
export SMTPS

after line: VCHKPW=”/home/vpopmail/bin/vchkpw”  and change port from smtp to 465 .

Now file should look like this:

#!/bin/sh
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
SMTPD=”/var/qmail/bin/qmail-smtpd”
TCP_CDB=”/etc/tcprules.d/tcp.smtp.cdb”
HOSTNAME=`hostname`
VCHKPW=”/home/vpopmail/bin/vchkpw”
SMTPS=1
export SMTPS

exec /usr/bin/softlimit -m 12000000 \
    /usr/bin/tcpserver -v -R -H -l $HOSTNAME -x $TCP_CDB -c “$MAXSMTPD” \
    -u “$QMAILDUID” -g “$NOFILESGID” 0 465 \
    $SMTPD $VCHKPW /bin/true 2>&1

3. Edit /var/qmail/supervise/smtp-ssl/log/run :

change /var/log/qmail/smtp  to /var/log/qmail/smtp-ssl

Continue reading »

written by MG \\ tags: , , ,