martedì 14 agosto 2018

Se ssh pass non funziona da script

Se lanciando lo script con all'interno l'sshpass da cron, questo non devesse  funzionare, provate ad aggiungere l'opzione StrictHostKeyChecking=no all'interno dell'ssh, come nell'esempio:


sshpass -p latuapassword ssh -o StrictHostKeyChecking=no utente@172.30.135.1 /home/utente/script.sh

venerdì 10 agosto 2018

GIT e proxy

Per far funzionare git senza check di certificati:

export GIT_SSL_NO_VERIFY=1
oppure

git config --global http.sslverify false

Per impostare una proxy:

git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port

Nella home troverete un file nascosto .gitconfig che contiene le impostazioni che effettuate

che può essere visualizzata anche con il comando

git config --global --get-regexp http.*


Le configurazioni possono essere annullate con questa sintassi:

git config --global --unset http.proxy
git config --global --unset http.sslVerify
git config --system --get https.proxy

Si trovano in oltre informazioni riguardo alle impostazioni delle passuord nel file:

/etc/environment



venerdì 29 giugno 2018

tutto sul sar

Il sar è uno strumento utilissimo per tenere sotto controllo i problemi di prestazioni dei vostri server.

Quello che fa il sar è tenere uno storico di una quantità di parametri  piuttosto nutrita.

L'installazione avviene, sotto debian (quindi ubuntu etc) così:


sudo apt-get install sysstats



sudo vi /etc/default/syssta


modificare la riga


ENABLED="true"



sudo vi /etc/cron.d/sysstat


cambiare

5-55/10 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1
a
*/2 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

Dopo 4 minuti inizierete ad avere uno storico, potete consultare la giornata di oggi con

sar

e le giornate precedenti saranno accessibili con:

sar -f /var/log/sysstat/sa03

dove 03 è il giorno del mese che vi interessa.

Opzioni diverse mostrano statistiche diverse, qualche esempio

sar
(senza opzioni)
mostra l'utilizzo della cpu

sar -r
mostra le statistiche sulla memoria

sar -q
relativo al load average


lunedì 11 giugno 2018

problemi con gphoto

Lanciando gphoto vi ritrovate il seguente errore

/etc/udev/rules.d $ gphoto2 --storage-info

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@lists.sourceforge.net>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --storage-info

Please make sure there is sufficient quoting around the arguments.


Notere che:

/etc/udev/rules.d $ ps -ef |  grep gphoto
mikilin+   717     1  0 11:45 ?        00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
mikilin+  1128     1  0 11:45 ?        00:00:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
mikilin+  1391     1  0 11:45 ?        00:00:00 /usr/lib/gvfs/gvfsd-gphoto2 --spawner :1.1 /org/gtk/gvfs/exec_spaw/1
mikilin+  1618  1440  0 11:54 pts/0    00:00:00 grep --color=auto gphoto

Personalmente ho risolto così:

cd /usr/lib/gvfs/
 sudo chmod a-x gvfs-gphoto2-volume-monito

e poi riavvio.