#!/bin/bash
if [ "$1" = "" ] ; then
echo -n "Nom du process : "
read process
else
process=$1
fi
ps aux | grep $process | grep -v grep | awk 'BEGIN { sum=0 } {sum=sum+$6; } END {printf("Taille RAM utilisée: %s Mo\n",sum / 1024)}'
Si tu donnes un poisson à un homme, il mangera un jour... Si tu lui apprends à pêcher, il mangera toujours !
jeudi 8 novembre 2018
Ping check
!/bin/bash
PINGLAT=$(ping -c1 8.8.8.8 | grep -i time | head -n 1 | awk '{print $7}' | awk 'BEGIN {FS="[=]|[ ]"} {print $2}')
PINGTHRESHOLD=400
PINGLATINT=$(echo "$PINGLAT/1" | bc)
echo $PINGLATINT
if [ $PINGLATINT -gt $PINGTHRESHOLD ]
then play -q ~jdoe/Musique/bip.mp3
else exit 0
fi
PINGLAT=$(ping -c1 8.8.8.8 | grep -i time | head -n 1 | awk '{print $7}' | awk 'BEGIN {FS="[=]|[ ]"} {print $2}')
PINGTHRESHOLD=400
PINGLATINT=$(echo "$PINGLAT/1" | bc)
echo $PINGLATINT
if [ $PINGLATINT -gt $PINGTHRESHOLD ]
then play -q ~jdoe/Musique/bip.mp3
else exit 0
fi
vendredi 14 septembre 2018
Configuration de Nextcloud (owncloud fork)
Fichier à mettre dans ./config/config.php :
$CONFIG = array (
'instanceid' => 'oc8d856504ae',
'passwordsalt' => 'MYSALT',
'secret' => 'SECRET',
'trusted_domains' =>
array (
0 => 'my.domain.com',
),
'datadirectory' => '/var/lib/owncloud/data',
'overwrite.cli.url' => 'https://my.domain.com',
'dbtype' => 'mysql',
'version' => '11.0.1.2',
'appstoreenabled' => true,
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'owncloud',
'dbpassword' => 'PASSWORD',
'installed' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'forcessl' => true,
'maintenance' => false,
'loglevel' => 2,
'theme' => '',
'trashbin_retention_obligation' => 'auto',
'updatechecker' => false,
'appcodechecker' => false,
'appstoreurl' => 'https://api.owncloud.com/v1',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/nextcloud/apps',
'url' => '/apps',
'writable' => true,
),
),
'mail_from_address' => 'cloud',
'mail_smtpmode' => 'php',
'mail_domain' => 'domain.com',
'htaccess.RewriteBase' => '/',
'updater.secret' => 'SECRET',
'updater.server.url' => 'https://updates.nextcloud.com/updater_server/',
'updater.release.channel' => 'beta',
);
lundi 17 juillet 2017
LAMP Jessie / Letsencrypt
echo 'deb http://http.debian.net/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
apt-get update
apt-get install python-certbot-apache -t jessie-backports
certbot --apache
# A la mano
certbot --apache
certonly
# Renew (90j)
certbot renew --dry-run
certbot renew
apt-get update
apt-get install python-certbot-apache -t jessie-backports
certbot --apache
# A la mano
certbot --apache
certonly
# Renew (90j)
certbot renew --dry-run
certbot renew
mercredi 12 juillet 2017
Tmux
Raccourcis :
Ctrl+B et
- :set-window-option synchronize-panes #pour sync les terms
- X #pour kill (puis y/n)
- " #pour split horizontal
- % #pour split vertical
- Flèche du haut, droite, bas gauche #pour de balader dans les terms (sous Windows)
Pour personnaliser un peu "tmux" (~/.tmux.conf) :
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
-- Voir aussi --
jeudi 22 juin 2017
Creation d'un raccourci sur Gnome (ubuntu / unity)
Pour créer un raccourci (.desktop) sur Ubuntu il faut installer :
$ sudo apt-get install --no-install-recommends gnome-panel
Ensuite il faut utiliser cette commande :
$ gnome-desktop-item-edit --create-new ~/monfichier.desktop
RQ : Pour lancer une commande shell ou un script, il faut renseigner dans le champ commande -> sh -c "ma_commande ou mon_script.sh"
$ sudo apt-get install --no-install-recommends gnome-panel
Ensuite il faut utiliser cette commande :
$ gnome-desktop-item-edit --create-new ~/monfichier.desktop
RQ : Pour lancer une commande shell ou un script, il faut renseigner dans le champ commande -> sh -c "ma_commande ou mon_script.sh"
vendredi 9 juin 2017
Squid configuration (rapide)
Voici une configuration rapide de squid (debian jessie, fichier /etc/squid3/squid.conf), qui permet de filtrer rapidement des sites, une liste noir est définie, il est possible d'ajouter les domaines à bloquer (.microsoft.com par exemple). Il y a également un delay_pool afin de limiter la bande passante :
# ACL acl SSL_ports port 443 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl CONNECT method CONNECT acl lan src 192.168.1.0/24 acl blacklist dstdomain "/etc/squid3/blacklist" # ACCESS http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access allow localhost manager http_access deny manager http_access allow localhost http_access deny blacklist http_access allow lan http_access deny all # SQUID PORT http_port 3128 # LOG coredump_dir /var/spool/squid3 # CONF refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320 # DELAY POOLS delay_pools 1 delay_class 1 1 delay_access 1 allow all delay_parameters 1 200000/200000 #delay_parameters 1 64000/64000 # 512 kbits == 64 kbytes per second # FORWARD forwarded_for off
Note : Afin de voir les logs squid plus facilement il est possible d'installer un petit utilitaire avec la commande "apt-get install squidview"
- Voir aussi -
Inscription à :
Articles (Atom)