Ну скрипт править смысла не вижу.
Предлагаю скрипт запускать не из крона тогда, а из отдельной программы висящей в трее.
Вот код.
Сохранить со своим названием.
Сделать исполнимым.
#!/bin/bash
#\
exec wish "$0" "$@"
global timer
set timer 10000
global myscript
set myscript "/usr/local/bin/myscript.sh"
global mytray
set mytray 1
global tray_ico
global trayicon
global icontype
#######################################################################
if { [ catch { package require Tk} ] } {
set mytray 0
tk_messageBox -icon info -type ok -title "Tk package not found" -parent . -message "Tk package not found!"
}
if { [ catch { package require tray} ] } {
if { [ catch { package require Tray} ] } {
set mytray 0
tk_messageBox -icon info -type ok -title "tray or Tray package not found" -parent . -message "tray or Tray package not found (tcl-tksystray) !"
} else {set icontype 1}
} else {set icontype 2}
if { [ catch { package require img::png } ] } {
set tray_ico "/usr/share/icons/ico.gif"
} else {
set tray_ico "/usr/share/icons/ico.png"
}
if { ![ file exists $tray_ico ] } {
set mytray 0
tk_messageBox -icon info -type ok -title "tray_ico" -parent . -message "Не могу найти файл $tray_ico"
}
if { ![ file exists $myscript ] } {
set mytray 0
tk_messageBox -icon info -type ok -title "script file not found" -parent . -message "Не могу найти файл $myscript"
}
if { $mytray == 1 } {
global myicon
set myicon .ico
if { $icontype==1 } {
if {![ catch { set trayicon [newti $myicon -pixmap $tray_ico ] } ] } {
bind $myicon <ButtonRelease-1> But1
bind $myicon <ButtonRelease-3> But2
} else {
set mytray 0
tk_messageBox -icon info -type ok -title "can't create tray icon (type1)" -parent . -message "can't create tray icon (type1)"
}
}
if { $icontype==2 } {
image create photo ico1 -file $tray_ico
if {![ catch { set trayicon [newti $myicon -pixmap ico1 ] } ] } {
bind $myicon <ButtonRelease-1> But1
bind $myicon <ButtonRelease-3> But2
} else {
set mytray 0
tk_messageBox -icon info -type ok -title "can't create tray icon (type2)" -parent . -message "can't create tray icon (type2)"
}
}
}
proc But1 {} {
MyExit
}
proc But2 {} {
MyExit
}
proc MyExit {} {
toplevel .myexit
wm geometry .myexit 200x60
wm title .myexit "Close ?"
label .myexit.te -text "Закрыть програму ?"
place .myexit.te -x 5 -y 5
button .myexit.ex -text "ДА, закрыть" -command {destroy .;}
place .myexit.ex -x 2 -y 25
button .myexit.clo -text "НЕТ" -command "destroy .myexit"
place .myexit.clo -x 130 -y 25
}
wm protocol . WM_DELETE_WINDOW chk_exit
proc chk_exit {} {
global mytray
global myicon
removeti $myicon;
exit
}
if { $mytray == 1 } {
wm withdraw .
MyRun
} else {
destroy .
}
proc MyRun {} {
global $myscript
global $timer
exec $myscript
after $timer MyRun2
}
proc MyRun2 {} {
MyRun
}
Соответственно
set timer 10000 - таймер 10 секунд
set myscript "/usr/local/bin/myscript.sh" - путь до вашего скрипта
set tray_ico "/usr/share/icons/ico.gif"
set tray_ico "/usr/share/icons/ico.png" - путь до вашей иконки - ну что висеть будет в трее.
Ну и надо поставить пакет
tcl-tksystray
и, если хотите иконку не gif а PNG, то
tcl-img
Вообщем теоретически должно работать :))))