snippets / language / shell

All snippets for language shell (18)

  1. script to test couchdb performances

    little script to test performances of couchdb.

     1 #!/bin/sh
    2 myver='0.1'
    3 CURL=$(which curl)
    4
    5 TMPFILE=$(mktemp /tmp/couchdb.XXXXXXXXXX) || exit 1
    6 SERVER_URL="http://localhost:5984"
    7 DB_TEST="couchdb_test"
    8 DOCS=""
    9 DOCS_MAX=100
    10
    11 if test $(which seq); then
    12 docs_seq=$(seq ${DOCS_MAX})
    13 elif test $(which jot); then
    14 docs_seq=$(jot -s " " ${DOCS_MAX} 0 ${DOCS_MAX})
    15 else
    16 echo "CANCELED: can't create sequence..."
    17 exit 0;
    18 fi
    19
    20
    21
    22 # create db
    23 resp=$(${CURL} --silent --request PUT ${SERVER_URL}/${DB_TEST}/)
    24 if test "${resp}" = '{"ok":true}'; then
    25 echo "Database ${DB_TEST} created"
    26 else
    27 echo "CANCELED : Error while creating database"
    28 exit 0;
    29 fi
    30
    31 # create docs
    32 start=`date +%s`
    33 for i in ${docs_seq}; do
    34 resp=$(${CURL} --silent --data "{ \"type\":\"test\", \"name\": \"${i}\" }" --request POST --header "Content-Type: application/json" ${SERVER_URL}/${DB_TEST}/)
    35 doc_id=`echo $resp | sed 's/.*"id"\:"\([^"]*\)".*/\1/'`
    36 current=`date +%s`
    37 DOCS="${DOCS} ${doc_id}"
    38 end=`date +%s`
    39 e=`expr ${end} - ${current}`
    40 start=`expr ${start} + ${e}`
    41 done
    42 end=`date +%s`
    43 t1=`expr ${end} - ${start}`
    44
    45 # fetch docs
    46 start=`date +%s`
    47 for doc_id in ${DOCS}; do
    48 resp=$(${CURL} --silent --request GET --header "Content-Type: application/json" ${SERVER_URL}/${DB_TEST}/{$doc_id})
    49 done
    50 end=`date +%s`
    51 t2=`expr ${end} - ${start}`
    52
    53 # delete docs
    54 start=`date +%s`
    55 for doc_id in ${DOCS}; do
    56 # first get doc
    57 current=`date +%s`
    58 resp=$(${CURL} --silent --request GET --header "Content-Type: application/json" ${SERVER_URL}/${DB_TEST}/{$doc_id})
    59 rev=`echo $resp | sed 's/.*"_rev"\:"\([^"]*\)".*/\1/'`
    60 end=`date +%s`
    61 e=`expr ${end} - ${current}`
    62 start=`expr ${start} + ${e}`
    63 resp=$(${CURL} --silent --request DELETE ${SERVER_URL}/${DB_TEST}/{$doc_id}?rev=${rev})
    64 done
    65 end=`date +%s`
    66 t3=`expr ${end} - ${start}`
    67
    68 #delete db
    69 resp=$(${CURL} --silent --request DELETE ${SERVER_URL}/${DB_TEST})
    70
    71 echo "Results :"
    72 echo "--------------------------"
    73 echo "${DOCS_MAX} docs created in ${t1}s"
    74 echo "${DOCS_MAX} docs fetched in ${t2}s"
    75 echo "${DOCS_MAX} docs deleted in ${t3}s"
    Posted by benoitc to shell couchdb performances benchmark ... saved by 1 person ... 0 comments ... 3 months, 3 weeks
  2. mysa-lear

    Récupère les SPAMs contenus dans le dossiers .Junk des comptes d'un serveur mail. Les SPAMs sont appris puis effacés.

     1 #!/bin/bash
    2 ###############################################################################
    3 #
    4 # mysa-lear : Donne à apprendre les dossiers ".Junk" des comptes mail d'un serveur
    5 #
    6 # Remarque :
    7 # - Les comptes doivent être de la forme $VBOX_PATH/_domaine_/_user_/
    8 #
    9 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
    10 # Version 1.0
    11 #
    12 ###############################################################################
    13 # This program is free software; you can redistribute it and/or
    14 # modify it under the terms of the GNU General Public License
    15 # as published by the Free Software Foundation; either version 2
    16 # of the License, or (at your option) any later version.
    17 #
    18 # This program is distributed in the hope that it will be useful,
    19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    21 # GNU General Public License for more details.
    22 #
    23 # You should have received a copy of the GNU General Public License
    24 # along with this program; if not,
    25 # - write to the Free Software
    26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    27 # - See http://www.gnu.org/licenses/gpl.html
    28 ###############################################################################
    29
    30 # Mails
    31 MAIL_SUBJECT="spamassassin for $(hostname)"
    32 #MAIL_FROM="spamassassin@$(hostname)"
    33 MAIL_TO=root
    34
    35 BOX_PATH=/home/vbox
    36 TRASH_PATH=/home/vbox/scenario-paintball.com/trash
    37 NB_SPAM=0
    38
    39 # On parcour les comptes mails
    40 for spam in $VBOX_PATH/*/*/.Junk/cur/*; do
    41 #echo "$spam"
    42 sa-learn --spam "$spam" > /dev/null
    43 rm -f $spam
    44 NB_SPAM=$[$NB_SPAM+1]
    45 done;
    46
    47 # NB de SPAM dans le dossier trash :
    48 NB_SPAM_TRASH=$(ls $TRASH_PATH/cur/| wc -l)
    49
    50 # Rapport par mail :
    51 MAIL_BODY="$NB_SPAM SPAM appri(s) par spamassassin.\n\n$NB_SPAM_TRASH SPAM dans le dossier Trash."
    52 #echo -e $MAIL_BODY
    53 echo -e $MAIL_BODY | /bin/mail -s "$MAIL_SUBJECT" $MAIL_TO
    Posted by llaumgui to shell cron gpl spamassassin ... saved by 1 person ... 0 comments ... 5 months, 3 weeks
  3. raccourcis bash

    plein de raccourcis pour bash, crédit : Benoît BALON (posteet)

     1 tab   <--->   auto complétion pour les fichiers et les dossiers
    2 ^[chaîne 1]^[chaîne 2]^ <---> lance la dernière commande en remplaçant la chaîne 1 par la chaîne 2
    3 !-[n] <---> rappelle la commande lancée il y a n commandes
    4 !! <---> lance la dernière commande
    5 !?[chaîne] <---> lance la dernière commande terminant par la chaîne de caractères
    6 !?[chaîne]? <---> lance la dernière commande contenant la chaîne de caractères
    7 ![chaîne] <---> lance la dernière commande commençant par la chaîne de caractères
    8 ![] <---> rappelle la commande n°... de l'historique
    9 !# <---> lance la plus ancienne commande de l'historique
    10 [commande] !^ <---> lance la commande avec le premier argument de la commande précédente
    11 [commande] !:[n]-[m] <---> lance la commande avec les arguments n à m de la commande précédente
    12 [commande] !:[] <---> lance la commande avec l'argument n°... de la commande précédente
    13 [commande] !$ <---> lance la commande avec le dernier argument de la commande précédente
    14 Alt + . <---> colle le dernier mot de la ligne précédente
    15 Alt + b <---> déplace le curseur d'un mot vers la gauche
    16 Alt + c <---> met en majuscule la lettre courante, en minuscules les autres lettres du mot courant, puis se place au mot suivant
    17 Alt + d <---> efface le mot suivant
    18 Alt + f <---> déplace le curseur d'un mot vers la droite
    19 Alt + t <---> échange le mot courant et le mot précédent
    20 Ctrl + _ <---> Annuler les dernières modifications (rester appuyé)
    21 Ctrl + a <---> déplace le curseur en début de ligne
    22 Ctrl + c <---> envoie le signal SIGINT au processus en cours
    23 Ctrl + d <---> efface le caractère courant, ou déconnecte (logout) si la ligne est déjà vide
    24 Ctrl + e <---> déplace le curseur en fin de ligne
    25 Ctrl + h <---> efface le dernier caractère
    26 Ctrl + k <---> coupe tout à droite du curseur
    27 Ctrl + l <---> efface l'écran (commande clear)
    28 Ctrl + n <---> commande suivante (équivalent à la touche flèche bas)
    29 Ctrl + o <---> exécute la commande (touche entrée)
    30 Ctrl + p <---> commande précédente (équivalent à la touche flèche haut)
    31 Ctrl + q <---> fait apparaître la saisie / relance l'affichage
    32 Ctrl + r <---> recherche dans l'historique (Ctrl + r pour remonter à la chaîne précédente)
    33 Ctrl + s <---> masque la saisie / arrête l'affichage (touche pause)
    34 Ctrl + t <---> permet d'inverser deux lettres
    35 Ctrl + u <---> coupe tout à gauche du curseur
    36 Ctrl + w <---> coupe le mot à gauche du curseur
    37 Ctrl + y <---> colle ce qui a été effacé à gauche du curseur (suite à un Ctrl + u)
    38 Ctrl + z <---> passe le processus en cours en arrière plan
    39 Echap, 10, A <---> répète 10 fois le caractère A
    40 Echap, 5, Ctrl + q, Ctrl + v, 9 <---> répète 5 fois le chiffre 9
    Posted by ismael to shell bash raccourcis ... saved by 1 person ... 2 comments ... 5 months, 4 weeks
  4. Rotate backup files (mysql - mysqlhotcopy)

    Makes backup named 1_dump.tar.gz, 2_dump.tar.gz... You'll get as many backup as $ROT_PERIOD. In this example, you have backup history for 15 days. Date is stored via extracted tgz dir name.

     1 #!/bin/bash
    2
    3 ################################################
    4 # author : Alexandre BULTE - alexandre[at]bulte[dot]net
    5 # license : GPL v2
    6 ################################################
    7
    8 BACKUP_PATH='/home/xxx/backup'
    9 # db names
    10 DBS='db1 db2 db3'
    11 MYSQL_USER='root'
    12 MYSQL_PASSWD='xxxxxx'
    13 ROT_PERIOD=15
    14 NEXT_ID=0
    15 DATE_TODAY=$( date +%Y%m%d-%H%M%S )
    16
    17 # rep sauvegarde
    18 REP=$BACKUP_PATH/$DATE_TODAY
    19 if [ ! -d $REP ];
    20 then
    21 mkdir $REP
    22 fi
    23
    24 # fetch biggest id in dir
    25 cd $BACKUP_PATH
    26 BIG_ID=$( ls -1 *_dump.tar.gz | tail -n 1 | cut -d '_' -f 1 ) &> /dev/null
    27
    28 if [ ! $BIG_ID ];
    29 then
    30 BIG_ID=0
    31 fi
    32
    33 # rotation if at least 1_dump.tar.gz
    34 for i in $( seq 1 $BIG_ID );
    35 do
    36 NEXT_ID=$( expr $i + 1 )
    37 NEXT_FILENAME=$NEXT_ID'_dump.tar.gz'
    38 FILENAME=$i'_dump.tar.gz'
    39 if [ -e $FILENAME ];
    40 then
    41 echo "$FILENAME exists"
    42 if [ $i = $ROT_PERIOD ];
    43 then
    44 echo "Removing oldest archive..."
    45 rm $i'_dump.tar.gz'
    46 else
    47 echo "Rotating $i..."
    48 cp $FILENAME $NEXT_FILENAME
    49 fi
    50 fi
    51 done
    52
    53 # sauvegarde
    54 mysqlhotcopy -q -u $MYSQL_USER -p $MYSQL_PASSWD $DBS $REP
    55
    56 # compression
    57 tar cfz 1_dump.tar.gz $DATE_TODAY
    58
    59 # suppression
    60 rm -rf $DATE_TODAY
    Posted by babeloued to shell mysql mysqlhotcopy rotate backup ... saved by 3 persons ... 0 comments ... 8 months, 2 weeks
  5. yum-check

    yum-check permet l'envoi par mail d'un "yum check-update" mis en forme. A appeler dans une tâche cron

     1 #!/bin/zsh
    2 ###############################################################################
    3 #
    4 # yum-check : Envoi par mail d'un "yum check-update" mis en forme
    5 #
    6 # by Guillaume Kulakowski a.k.a LLaumgui <guillaume at llaumgui dot com>
    7 # Version 1.0
    8 #
    9 # Require : zsh, yum
    10 #
    11 ###############################################################################
    12 # This program is free software; you can redistribute it and/or
    13 # modify it under the terms of the GNU General Public License
    14 # as published by the Free Software Foundation; either version 2
    15 # of the License, or (at your option) any later version.
    16 #
    17 # This program is distributed in the hope that it will be useful,
    18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    20 # GNU General Public License for more details.
    21 #
    22 # You should have received a copy of the GNU General Public License
    23 # along with this program; if not,
    24 # - write to the Free Software
    25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    26 # - See http://www.gnu.org/licenses/gpl.html
    27 ###############################################################################
    28
    29
    30 # yum check-update
    31 LIST=$(/usr/bin/yum check-update -d0)
    32 NB_PCK=$(echo $LIST| wc -l)
    33 let NB_PCK--
    34
    35
    36 #### [ Paramètres à modifier ] ####
    37 MAIL_ENTETE="[spb-box.scenario-paintball.com]"
    38 MAIL_BODY_NONEW="Il n'y a pas de packet a mettre à jour."
    39 MAIL_BODY_NEW="Il y a $NB_PCK packet(s) a mettre à jour."
    40 MAIL_TITLE_NONEW="$MAIL_ENTETE Pas de nouvelle mise a jour"
    41 MAIL_TITLE_NEW="$MAIL_ENTETE $NB_PCK mise(s) a jour"
    42 #### [ / Paramètres à modifier ] ####
    43
    44
    45 MAIL_TITLE=$MAIL_TITLE_NONEW
    46 MAIL_BODY=$MAIL_BODY_NONEW
    47 if [ $NB_PCK -gt 0 ]; then
    48 MAIL_TITLE=$MAIL_TITLE_NEW
    49 MAIL_BODY="$MAIL_BODY_NEW\n\n$LIST"
    50 fi
    51
    52
    53 echo -e $MAIL_BODY | /bin/mail -s "$MAIL_TITLE" root
    Posted by llaumgui to shell zsh yum check-update gpl ... saved by 1 person ... 0 comments ... 8 months, 3 weeks
  6. replace ^M by new line with vim

    tip to **replace ^M by unix new line ending** that appear on some file. ^ mean _ctrl key_.

    1 :%s/^V^M/\r/g
    Posted by benoitc to shell vim convert convertir content ... saved by 4 persons ... 1 comments ... 8 months, 3 weeks
  7. pkgsearch - Search archlinux pkgbuild

    pkgsearch list all packages that contain your string and display installed packages. pksearch -h for options

      1 #!/bin/bash
    2 #
    3 # pkgsearch
    4 #
    5 # Copyright (c) 2006 by Benoit Chesneau <benoit@bchesneau.info>
    6 #
    7 # This program is free software; you can redistribute it and/or modify
    8 # it under the terms of the GNU General Public License as published by
    9 # the Free Software Foundation; either version 2 of the License, or
    10 # (at your option) any later version.
    11 #
    12 # This program is distributed in the hope that it will be useful,
    13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    15 # GNU General Public License for more details.
    16 #
    17 # You should have received a copy of the GNU General Public License
    18 # along with this program; if not, write to the Free Software
    19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    20 # USA.
    21 #
    22 # AUTHORS :
    23 # - Maintainer : Benoit Chesneau <benoitc@archlinuxfr.org>
    24 # - Contributor : slubman <slubman@archlinuxfr.org>
    25 # CHANGELOG :
    26 # - version 0.6
    27 # cosmethics changes
    28 # internal rewrite
    29 # - version 0.5 (2007-02-28 15:19) :
    30 # search on multiple words (slubman)
    31 # search in description is case insensitive (slubman)
    32 # - version 0.4 (2007-02-28 13:14) :
    33 # add possibility to search in repository (slubman)
    34 # add possibility to exclude repository in search (slubman)
    35 # - version 0.3 (2007-02-28) :
    36 # add possibility to display only installed packages (slubman)
    37 # add possibility to display only not installed packages (benoitc)
    38 # - version 0.1
    39 # initial release
    40 #
    41
    42 PACMAN_SOURCES="/var/lib/pacman"
    43 PWD=`pwd`
    44
    45 cd $PACMAN_SOURCES
    46
    47 myver="0.6"
    48
    49
    50 NAME_ONLY=0
    51 USE_COLOR="y"
    52 NOT_INSTALLED=0
    53 ONLY_INSTALLED=0
    54 IN="all packages"
    55 SKIP_REPO=()
    56 IN_REPO=()
    57 search_string=()
    58
    59 installed() {
    60 if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
    61 echo -e "\033[1;35m$1\033[1;0m \033[1;35m(*)\033[1;0m" >&2
    62 else
    63 echo "$1 (*)" >&2
    64 fi
    65 let nb=nb+1
    66 }
    67
    68 not_installed() {
    69 echo "$1" >&2
    70 let nb=nb+1
    71 }
    72
    73 msg() {
    74 if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
    75 echo -e "\033[1;32m==>\033[1;0m \033[1;1m$1\033[1;0m" >&2
    76 else
    77 echo "==> $1" >&2
    78 fi
    79 }
    80
    81 error() {
    82 if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
    83 echo -e "\033[1;31m==> ERROR:\033[1;0m \033[1;1m$1\033[1;0m" >&2
    84 else
    85 echo "==> ERROR: $1" >&2
    86 fi
    87 }
    88
    89 usage() {
    90 echo "pkgsearch $myver"
    91 echo "usage : $0 [-n] <searchstring>"
    92 echo
    93 echo "pkgsearch list all packages that contain your"
    94 echo "string and display installed packages"
    95 echo
    96 echo "Options"
    97 echo " -n, --name Search on pkgname only"
    98 echo " -m, --nocolor Disable colorized output messages"
    99 echo " -i, --installed Display only installed packages"
    100 echo " -sr, --skip-repo Exclude repo in search"
    101 echo " -ir, --ni-repo Search only in repo"
    102 echo " -s, --skip Display only not installed packages"
    103 echo " -h, --help Display usage"
    104 }
    105
    106 if [ $# -lt 1 ]; then
    107 usage
    108 exit 1
    109 fi
    110
    111 while [ "$#" -ne "0" ]; do
    112 case $1 in
    113 --installed|-i)
    114 ONLY_INSTALLED=1
    115 IN="only installed packages"
    116 ;;
    117 --help|-h)
    118 usage
    119 exit 0
    120 ;;
    121 --name|-n)
    122 NAME_ONLY=1
    123 ;;
    124 --nocolor|-m)
    125 USE_COLOR=n
    126 ;;
    127 --skip|-s)
    128 NOT_INSTALLED=1
    129 IN="only not installed packages"
    130 ;;
    131 --skip-repo|-sr)
    132 SKIP_REPO[${#SKIP_REPO[*]}]=$2
    133 shift
    134 ;;
    135 --in-repo|-ir)
    136 IN_REPO[${#IN_REPO[*]}]=$2
    137 shift
    138 ;;
    139 *)
    140 search_string[${#search_string[*]}]=$1
    141 ;;
    142 esac
    143 shift
    144 done
    145
    146 if [ "$NOT_INSTALLED" = "1" -a "$ONLY_INSTALLED" = "1" ]; then
    147 error "Error : Skip or show installed packages, but not both..."
    148 exit 0
    149 fi
    150
    151 nb=0
    152
    153 msg "Looking for \""${search_string[*]:-nothing}\""\n\tin ${IN}\n\tof ${IN_REPO[*]:-all repos}\n\texcluding ${SKIP_REPO[*]:-no repo}..."
    154 search_token=${search_string[0]}
    155 unset search_string[0]
    156 for word in ${search_string[*]}; do
    157 search_token="$search_token|$word"
    158 done
    159 search_token="($search_token)"
    160
    161 for repo in `find * -maxdepth 0 -type d`; do
    162 if ! [ $repo = 'local' ]; then
    163 if [ "$(echo ${SKIP_REPO[@]} | grep $repo)" ]; then
    164 continue
    165 fi
    166 if [ "$(echo ${IN_REPO[@]} | grep -v $repo)" ]; then
    167 continue
    168 fi
    169 cd $repo
    170 for pkg in `/bin/ls`; do
    171 if [ -f $pkg/desc ]; then
    172 if [ "$NAME_ONLY" = "1" ]; then
    173 if [ "$(echo $pkg | grep -E $search_token)" ]; then
    174 NAME=`grep -A 1 NAME $pkg/desc | tail -1`
    175 VERSION=`grep -A 1 VERSION $pkg/desc | tail -1`
    176 if [ -d $PACMAN_SOURCES/local/$pkg ]; then
    177 if [ "$NOT_INSTALLED" = "0" ]; then
    178 installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    179 fi
    180 else
    181 if [ "$ONLY_INSTALLED" = "0" ]; then
    182 not_installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    183 fi
    184 fi
    185 fi
    186 else
    187 if [ "$(grep -E -i $search_token $pkg/desc)" ]; then
    188 NAME=`grep -A 1 NAME $pkg/desc | tail -1`
    189 VERSION=`grep -A 1 VERSION $pkg/desc | tail -1`
    190 if [ -d $PACMAN_SOURCES/local/$pkg ]; then
    191 if [ "$NOT_INSTALLED" = "0" ]; then
    192 installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    193 fi
    194 else
    195 if [ "$ONLY_INSTALLED" = "0" ]; then
    196 not_installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    197 fi
    198 fi
    199 fi
    200 fi
    201 fi
    202 done
    203 cd ..
    204 fi
    205 done
    206
    207 echo
    208 echo "$nb packages found.."
    209
    210 cd $PWD
    Posted by benoitc to shell archlinux packages bash ... saved by 2 persons ... 0 comments ... 9 months
  8. Connaître son adresse ip

    -- Nécessite le programme links

    1 #!/bin/bash
    2
    3 links -dump http://www.whatismyip.com/automation/n09230945.asp | sed -e 's/ //g'
    Posted by raf to shell ip shell links ... saved by 4 persons ... 2 comments ... 9 months
  9. Sync to second TwinView display

    Everytime my computer starts, I have to select "Sync to my second screen" in nvidia-settings. Otherwise it sync to the first display. This command does the job in a terminal and can be automated.

    1 nvidia-settings --assign XVideoSyncToDisplay=2
  10. change aléatoirement le fond d'écran de gnome

    le fichier /tmp/picture_bg contient l'historique des fonds d'écrans utilisés.

     1 #! /bin/bash
    2
    3 # can be : none wallpaper stretched scaled centered
    4 picture_options="scaled"
    5
    6 bgpath="${1:-/home/mobidyc/perso/artgallery/desktop/}"
    7 num="0"
    8 total_pix="0"
    9 pix_tmp="${2:-/tmp/rotate_background_gnome.tmp}"
    10
    11 find $bgpath ! -type d > ${pix_tmp}
    12 if [[ "$?" != "0" ]]
    13 then
    14 echo "$(basename) - find est tombe en erreur"
    15 exit 1
    16 fi
    17
    18 total_pix="$(wc -l ${pix_tmp} | awk '{print $1}')"
    19 if [[ "$?" != "0" ]]
    20 then
    21 echo "$(basename) - wc est tombe en erreur"
    22 exit 1
    23 fi
    24
    25 let rand_pic="${RANDOM}%${total_pix}"
    26
    27 while read picture_bg
    28 do
    29 num="$((${num}+1))"
    30 if [[ "${num}" = "${rand_pic}" ]]
    31 then
    32 /usr/X11R6/bin/gconftool-2 --type string --set /desktop/gnome/background/picture_filename "${picture_bg}"
    33 test "$?" = "0" && {
    34 echo "$(date): ${picture_bg}" >> /tmp/picture_bg
    35 }
    36 /usr/X11R6/bin/gconftool-2 --type string --set /desktop/gnome/background/picture_options "${picture_options}"
    37 fi
    38 done <${pix_tmp}
    39
    40 rm $pix_tmp
    41
    42 exit 0
showing 10, 25, 50 items per pages

Pages : 1 2

Flux RSS friendsnippetLatest snippets


More...