shell

File Directory Change Monitoring

1) Obiettivo: Vogliamo controllare una directory unix, segnalando via e-mail se il suo contenuto cambia. 2) Soluzione: Modificare opportunamente i parametri di configurazione, quindi lanciare in background (sh filedirChangeMonitoring.sh &) il seguente script. #!/bin/bash # # filedirChangeMonitoring.sh # DATE : 2014-07-30 # DESC.: # Script for the monitoring of files in a directory # The script checks if changes are made to the files of a directory and it alerts with an e-mail # Before running the script modify the following parameters: TO_ADDRESS, FROM_EMAIL_ADDRESS, xDirMon and xTime # PARENT SCRIPT: none # # NOTE: # The script should be run Continua a leggere

Ricavare dati sql tramite script di shell

A volte può nascere l’esigenza di dover reperire dei dati da un DB da utilizzare all’interno di uno script linux o Unix. Utilizzando la shell Bash e possibile creare una query nel seguente modo : dir_in=`sqlplus -s $PMS_CONN_STRING

Retrive sqldata through shell script

Normal 0 14 false false false IT X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:”Tabella normale”; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:””; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:”Calibri”,”sans-serif”; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:”Times New Roman”; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} It could be useful get data from DB by a  bash script Linux. Using a shell Bash is possible to create the following query: dir_in=`sqlplus -s $PMS_CONN_STRING <<EOF SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF select directory_path FROM all_directories WHERE directory_name = ‘GARBAGE_SFTP_AREA’; exit EOF Analyze this script. The query above, very simple, extracts Continua a leggere