[Fcron] Capricieux avec scripts perl ( en cours )

Applications, problèmes de configuration réseau
peuks
archer
Messages : 113
Inscription : dim. 29 nov. 2009, 09:49

[Fcron] Capricieux avec scripts perl ( en cours )

Message par peuks »

Bonjour.


Pour pouvoir changer de fond d'écran aléatoirement; j'ai trouvé un script fort utile pour faire cela sous gnome . J'ai modifié ce dernier pour l'utiliser avec fcron mais quelque soit la version ( que j'ai modifié ou non ) il ne se lance jamais .

L'original.

Code : Tout sélectionner

#!/usr/bin/perl -w
use strict;
use warnings;

my $searchPath = '/home/peuks/Images/wall/';   # Set to the directory you want to have searched for photos
my $switchTime = 900;               # Edit to the number of seconds between photo switches

# bgotd-- background of the day
# Written by Michael Moore, Nov. 2007, placed in the public domain

my @photos = `find $searchPath -type f | grep [jJ][pP][eE]*[gG]`;
chomp(@photos);
my $photo;

while(1)
{
    $photo = $photos[rand($#photos)];
    `gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$photo"`;
    sleep($switchTime);
}
Le modifié

Code : Tout sélectionner

#!/usr/bin/perl -w
use strict;
use warnings;

my $searchPath = '/home/peuks/Images/wall/';   # Set to the directory you want to have searched for photos

# bgotd-- background of the day
# Written by Michael Moore, Nov. 2007, placed in the public domain

my @photos = `find $searchPath -type f | grep [jJ][pP][eE]*[gG]`;
chomp(@photos);
my $photo;

    $photo = $photos[rand($#photos)];
    `gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$photo"`;
Pour pouvoir le lancer avec fcron j'ai mis cela pour le lancer toutes les 15 minutes.

Code : Tout sélectionner

*/15 * * * * /home/peuks/Documents/Scripts/wallpaper #( le script se trouve ici ) 
En testant notify-send test par exemple ça fonctionne mais avec le script non .
Je ne vois vraiment pas d'ou peut provenir l'erreur. Le fait que le script est écrit en perl ?
oktoberfest
Maître du Kyudo
Messages : 1855
Inscription : mer. 06 janv. 2010, 13:51
Localisation : Ried - Alsace - France

Re: [Fcron] Capricieux avec scripts perl ( en cours )

Message par oktoberfest »

Si tu lances ton script à la main dans un shell est-ce qu'il fonctionne ?
Et fcron doit avoir un log, non ? Qui a-t-il dedans ?
La majorité des bugs se situe entre la chaise et le clavier...
Arrêtez de vous prendre la tête avec les partitions... passez au LVM
Répondre