Lorsque j'essaie cette commande dans lxterminal :
Code : Tout sélectionner
HOME=/home/neo DISPLAY=:0 feh --bg-max /home/neo/earth/wallpaper.jpg
Ce code fonctionne correctement, meme si j'execute changer.sh par lxterminal, mais lorsqu'il s'agit du cron, c'est la que le problème apparait.
le contenu de changer.sh :
Code : Tout sélectionner
#!/bin/bash
export DISPLAY=:0
PATH=/sbin:/bin:/usr/bin
cd /home/neo/earth/
rm eq.gif
wget http://www.opentopia.com/images/cams/world_sunlight_map_rectangular.jpg -O world.jpg
temp=$(stat -c%s world.jpg)
if [[ $temp > 1000 ]]
then rm world_sunlight_Wallpaper.jpg
mv world.jpg world_sunlight_Wallpaper.jpg
fi
convert world_sunlight_Wallpaper.jpg -crop 1560x887+0+0 w_1.jpg
convert world_sunlight_Wallpaper.jpg -crop 40x887+1560+0 w_0.jpg
convert -size 1600x887 xc:black wallpaper.jpg
composite -blend 85 -gravity East w_1.jpg wallpaper.jpg wallpaper.jpg
composite -blend 85 -gravity West w_0.jpg wallpaper.jpg wallpaper.jpg
S_act=$(( $( date -u '+%T' | sed 's/^[0]//' | sed -r 's/[\:]{1}[0]?/ \* 60 + /2'| sed -r 's/[\:]{1}[0]?/ \* 3600 + /' ) + 86400 ))
D_act=$( date -u '+%d' | sed 's/^[0]//' )
wget http://earthquake.usgs.gov/earthquakes/catalogs/eqs1day-M2.5.txt -O eq
COM=( )
LAB=( "-fill black -stroke purple -strokewidth 1 -pointsize 16" )
while read line
do
lat_eq=$( echo $( echo "887*(90-($( echo $line | cut -d' ' -f6 | cut -d',' -f2 )))/180+20"
) | bc )
long_eq=$( echo $( echo "1600*($( echo $line | cut -d' ' -f6 | cut -d',' -f3 )+180)/360" ) | bc )
M_eq=$( echo $line | cut -d' ' -f6 | cut -d',' -f4 )
d_eq=$( echo $M_eq^2*0.4+$lat_eq | bc )
D_eq=$( echo $line | cut -d" " -f3 | sed -r 's/^[0]|,//' )
if [[ $D_act == $D_eq ]]
then ajust=86400
else ajust=0
fi
S_eq=$(( $ajust + $( echo $line | cut -d" " -f5 | sed 's/^[0]//' | sed -r 's/[\:]{1}[0]?/ \* 60 + /2'| sed -r 's/[\:]{1}[0]?/ \* 3600 + /' ) ))
dif=$(( $S_act - $S_eq ))
if [[ $( echo $M_eq*10 | bc | sed -r 's/\.[0]+$//') -ge "60" ]]
then ofxt=$( echo $long_eq-10 | bc )
ofyt=$( echo $lat_eq+5 | bc )
LAB+=( " -draw \"text $ofxt,$ofyt '$M_eq'\"" )
fi
if [[ $dif -lt "86400" ]]
then gf=$( echo $dif*128/86400 | bc )
gs=$( echo $dif*128/86400+127 | bc )
colf="rgb(255,$gf,0)"
cols="rgb(255,$gs,0)"
else colf="rgb(255,128,0)"
cols="rgb(255,255,0)"
fi
COM=( "-fill '$colf' -stroke '$cols' -strokewidth 2 -draw 'circle $long_eq,$lat_eq
$long_eq,$d_eq'" "${COM[@]}" )
done < <(cat eq | grep -P '^[a-z]')
#157
COM="convert -size 1600x887 xc:transparent ${COM[@]} -channel RGBA -blur 3x3 ${LAB[@]} eq.png"
eval $COM
composite -blend 70 -gravity Center eq.png wallpaper.jpg wallpaper.jpg
feh --bg-max /home/neo/earth/wallpaper.jpg &
le cron actuel :