Port monitoring script.

$cat /root/check-smtp-port.sh 
#!/bin/bash
host=$1
port=25
date=$(date +"%Y-%m-%d-%M:%S")
log_file=/var/log/${host}-port-check.log

#rotate log file
mv $log_file $log_file.$date
touch $log_file

#loop port check
while [[ $end != '1' ]]; do
    nc -z -i 2 -w 2 $host $port > /dev/null
    exit_code=$(echo $?)
    if [[ $exit_code != 0 ]]; then
        echo "$(date) - Error: Could not access Port ${port} on ${host}." | tee -a ${log_file}
    fi
    sleep 2
done

Run script… discount cialis

(reverse-i-search)`noh': nohup ./check-smtp-port.sh <host> > /dev/null 2>&1 &

Logfile output… viagra online free trial Levitra Prices at Costco

40 mg generic cialis cuanto dura el efecto del sildenafil 50 mg pills just like viagra

CentOS Systemctl and chkconfig

Using chkconfig on centos (systemctl)

View all available services….

[root@li699-77 ~]# systemctl list-unit-files | grep vsftpd
vsftpd.service disabled
vsftpd@.service disabled
vsftpd.target disabled

Enable run level links.

[root@li699-77 ~]# systemctl enable vsftpd.target
ln -s ‘/usr/lib/systemd/system/vsftpd.target’ ‘/etc/systemd/system/multi-user.target.wants/vsftpd.target’

[root@li699-77 ~]# systemctl enable vsftpd.service
ln -s ‘/usr/lib/systemd/system/vsftpd.service’ ‘/etc/systemd/system/multi-user.target.wants/vsftpd.service’

Verify chkconfig

[root@li699-77 ~]# systemctl list-unit-files | grep vsftpd
vsftpd.service enabled
vsftpd@.service disabled
vsftpd.target enabled