Page 1 sur 1

[Fcron] Capricieux avec scripts perl ( en cours )

Publié : dim. 09 janv. 2011, 12:05
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 ?

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

Publié : dim. 09 janv. 2011, 13:53
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 ?