Pages

Sunday, July 24, 2022

How to find a string or text in a file on Linux

How to find a string or text in a file on Linux 


 grep -r --include=\*.forward 'andre'


Remark : Find a sting "andre" on file .forward



Tuesday, October 1, 2019

Select first name from column in firebird.



How To select firstname from employee name in firebird.


SELECT IIF(POSITION(' ' IN column_name) > 0, SUBSTRING(column_nameFROM 1 FOR POSITION(' ' IN column_name) ), column_name) First_name from Table_name

Monday, January 7, 2019

Monday, December 10, 2018

Running file .js on server linux using pm2

Using  "pm2":

https://github.com/Unitech/pm2

Install Application :
- install pm2 "npm install pm2 -g"

- cd  folder/app/server.js

- Runing  " pm2 start server.js"



* gunakan command "pm2 list" untuk melihat seluruh process yang ada
* "pm2 <stop | start | delete | restart> <app_name | id> " untuk mengontrol process


* "pm2 logs <app_name | id>" untuk mendapatkan log file

Wednesday, October 31, 2018

Datediff on databse firebird

Datediff on databse firebird


datediff (hour from current_timestamp to timestamp '12-Jun-2059 06:00')
datediff (minute from time '0:00' to current_time)
datediff (month, current_date, date '1-1-1900')
datediff (day from current_date to cast(? as date))


example :

select datediff(day from current_date to cast('2018-11-01' as date)) from  rdb$database



Wednesday, September 5, 2018

How to Postfix Flush the Mail Queue

Under Postfix MTA,

just enter the following command to flush the mail queue:
# postfix flush
OR
# postfix -f

To see mail queue, enter:
# mailq

To list all mail of queue, use one of the following commands.
# postqueue -p

To remove all mail from the queue, enter:
# postsuper -d ALL

To remove all mails in the deferred queue, enter:
# postsuper -d ALL deferred

Monday, March 5, 2018

SSL Library Error: -8181 Certificate has expired on centos server

SSL Library Error: -8181 Certificate has expired
Unable to verify certificate 'Server-Cert'. Add "NSSEnforceValidCerts off" to nss.conf so the server can start until the problem can be resolved


# vim /etc/httpd/conf/httpd.conf

add text "NSSEnforceValidCerts off"

and then save.

For reference How to know certification expiration date
Please execute command below.

# certutil -L -d /etc/httpd/alias -n Server-Cert

Restart service nss
# service nscd restart


Restart Service apache
# service httpd restart



Reff : https://ecl.ntt.com/en/news/2016122801/

Friday, November 24, 2017

how to auto mounting samba from fstab


How to auto mounting samba from fstab

#vim /etc/fstab

put this script :

//192.168.18.6/backup1 /mnt/backup1 cifs username=xxxxx,password=xxxxx 0 0

and then 

# mount -a

check result :

df -h

Sunday, June 4, 2017

How to synchronize file server without password root with SSH keygen on Centos 6


# ssh-keygen

ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 

NB: Please dont put password (Only Enter)

Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
41:71:f3:9b:14:tc:6f:de:fa:m1:05:c5:0d:65:b6:b7 root@svr7.server.co.id
The key's randomart image is:
+--[ RSA 2048]----+
|        o.oo. .+*|
|       . ..o.. ++|
|        .  .o ...|
|         . .oo .o|
|        x  oo. w.|
|            .... |
|             .o  |
|            .  . |
|             ..  |
+-----------------+



Copy id_rsa to server destination

# ssh-copy-id -i ~/.ssh/id_rsa.pub 192.9.18.25




Synchronize Script

# rsync -avz --delete /mnt/test/ root@192.9.18.25:/mnt/test/



Tuesday, December 27, 2016

How to Mouting NFS Synology on Centos 6.5

#vim /etc/fstab


Put :

//192.9.18.11/Onlinebackup1/ /mnt/backup1   cifs  user=backup,password=xxx,rw,iocharset=utf8 0 0



Esc : wq   for Safe.

Friday, December 23, 2016

How to replace string on database firebird

How to  replace string on database firebird


select     replace ('Billy Wilder',  'il', 'oog') from  tablemaster_employee where  em_emplcode = 11111




Wednesday, September 7, 2016

How To Fix PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" on centos 6.5

How to fix error PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"  centos 6.5



Answer : Open terminal

# yum clean all


Enter.






Friday, March 18, 2016

Find and remove all file from termilal Linux




# find . -name "*Locky*" -exec rm -rf {} \;

or

# find . -type f -name "*.Locky*" -exec rm -i {} \;

remarks : 

-name "FILE-TO-FIND" : File pattern.
-exec rm -rf {} \; : Delete all files matched by file pattern.
-type f : Only match files and do not include directory name

Tuesday, February 16, 2016

Delete files older then 7 day on windows



forfiles -p "D:\test" -s -m *.* -d 7 -c "cmd /c del @path"


save with extention .bat

Wednesday, November 11, 2015

How to fix yum error "Metadata file does not match checksum"

how to fix yum error "Metadata file does not match checksum"

$sudo yum clean metadata v

How to fix error yum "network is unreachable" or "couldn't connect to host" errors while running yum command

Fix error yum "network is unreachable" or "couldn't connect to host" errors while running yum command.

$ sudo vi /etc/yum.conf 



[main]


proxy=http://proxy.com:8000

How to fix yum error '404 errors' on CentOS 6

How to fix yum error '404 errors' on CentOS 6

 $ sudo yum clean metadata
 $ sudo yum clean all