chirpyform
Programmer
Hello
I wasn't really sure which forum to post the question in.
I have a script that works perfectly well with Solaris ksh. When I changed to Linux and tried the same script I got the following error :
./rmc_ramses_fullinit.ksh[320]: /rmc/G2R1C0_java/log/20050216.090658.ramsesinit.log1: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /rmc/G2R1C0_java/log/20050216.090658.ramsesinit.log1: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /rmc/G2R1C0_java/log/20050216.090658.ramsesinit.log1: restricted
I think the error comes from the following code :
# fonction test d'enchainement
test_chaine()
{
#echo "Dans test_chaine pour $1" >>$FICLOG
if [[ -f $TEMDIR/$1.BAD ]]; then
echo "Erreur detectee dans $1, branche d execution abandonnee" >>
$FICLOG
return 1
fi
if [[ -f $TEMDIR/$1.NOX ]]; then
echo "Abandon detecte dans $1, branche d execution abandonnee" >>
$FICLOG
return 1
fi
typeset -i retstatus
while [[ (! -f $TEMDIR/$1.FIN) && (! -f $TEMDIR/$1.DBL) ]] do
relance_prof 9
ls >/dev/null 2>&1 $TEMDIR/P.[0-9].$1.PEN
retstatus=$?
if [[ (-f $TEMDIR/$1.RUN) || (-f $TEMDIR/$1.ATT) || ($retstatus -eq
0) ]]; then
# echo "$1 retarde, $SLEEP_TIME" >>$FICLOG
sleep $SLEEP_TIME
elif [[ -f $TEMDIR/$1.BAD ]]; then
echo "Erreur detectee dans $1, branche d execution
abandonnee" >>$FICLOG
return 1
elif [[ -f $TEMDIR/$1.NOX ]]; then
echo "Abandon detecte dans $1, branche d execution
abandonnee" >>$FICLOG
return 1
else
echo "Situation transitoire: absence de temoin pour $1: on
reboucle" >>$FICLOG
fi
done
#echo "Sortie de test_chaine $1" >>$FICLOG
relance_prof 9
return $2
}
flp()
{
# Donner une chance aux processus pending de priorite >= à la priorité de la
nouvelle tâche
echo "avant relance $* à $(date)" >>$FICLOG
relance_prof $1
echo "apres relance $* à $(date)" >>$FICLOG
lance_prof $*
return $?
}
# fonction de relance si possible des scripts en état "pending"
relance_prof()
{
typeset -ir mprior=${1:-9}
mv relance_en_cours relance.$mprior >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
typeset -r listfic=$(cd $TEMDIR; ls 2>/dev/null *.PEN)
typeset idf
typeset -i cpucount cpri
# echo "relance_en_cours $(date)" >>$FICLOG
for idf in $listfic; do
cpu_count ; cpucount=$?
if [[ $cpucount -ge $PLIMIT ]]; then
break
fi
cpri=$(awk -vmidf=$idf 'BEGIN { split(midf,a,/[.]/); print
a[2]; }' )
# Uniquement si la priorité est inférieure au paramètre fourni
if [[ $cpri -le $mprior ]]; then
# echo "tentative de relance pour $idf à $(date) args
$(cat $TEMDIR/$idf)" >>$FICLOG
lance_prof $(cat $TEMDIR/$idf)
fi
done
# echo "fin relance en cours $(date)" >>$FICLOG
mv relance.$mprior relance_en_cours >/dev/null 2>&1
fi
return 0
}
Any ideas would be gratefully received
Chris
I wasn't really sure which forum to post the question in.
I have a script that works perfectly well with Solaris ksh. When I changed to Linux and tried the same script I got the following error :
./rmc_ramses_fullinit.ksh[320]: /rmc/G2R1C0_java/log/20050216.090658.ramsesinit.log1: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /rmc/G2R1C0_java/log/20050216.090658.ramsesinit.log1: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /dev/null: restricted
./rmc_ramses_fullinit.ksh[320]: /rmc/G2R1C0_java/log/20050216.090658.ramsesinit.log1: restricted
I think the error comes from the following code :
# fonction test d'enchainement
test_chaine()
{
#echo "Dans test_chaine pour $1" >>$FICLOG
if [[ -f $TEMDIR/$1.BAD ]]; then
echo "Erreur detectee dans $1, branche d execution abandonnee" >>
$FICLOG
return 1
fi
if [[ -f $TEMDIR/$1.NOX ]]; then
echo "Abandon detecte dans $1, branche d execution abandonnee" >>
$FICLOG
return 1
fi
typeset -i retstatus
while [[ (! -f $TEMDIR/$1.FIN) && (! -f $TEMDIR/$1.DBL) ]] do
relance_prof 9
ls >/dev/null 2>&1 $TEMDIR/P.[0-9].$1.PEN
retstatus=$?
if [[ (-f $TEMDIR/$1.RUN) || (-f $TEMDIR/$1.ATT) || ($retstatus -eq
0) ]]; then
# echo "$1 retarde, $SLEEP_TIME" >>$FICLOG
sleep $SLEEP_TIME
elif [[ -f $TEMDIR/$1.BAD ]]; then
echo "Erreur detectee dans $1, branche d execution
abandonnee" >>$FICLOG
return 1
elif [[ -f $TEMDIR/$1.NOX ]]; then
echo "Abandon detecte dans $1, branche d execution
abandonnee" >>$FICLOG
return 1
else
echo "Situation transitoire: absence de temoin pour $1: on
reboucle" >>$FICLOG
fi
done
#echo "Sortie de test_chaine $1" >>$FICLOG
relance_prof 9
return $2
}
flp()
{
# Donner une chance aux processus pending de priorite >= à la priorité de la
nouvelle tâche
echo "avant relance $* à $(date)" >>$FICLOG
relance_prof $1
echo "apres relance $* à $(date)" >>$FICLOG
lance_prof $*
return $?
}
# fonction de relance si possible des scripts en état "pending"
relance_prof()
{
typeset -ir mprior=${1:-9}
mv relance_en_cours relance.$mprior >/dev/null 2>&1
if [[ $? -eq 0 ]]; then
typeset -r listfic=$(cd $TEMDIR; ls 2>/dev/null *.PEN)
typeset idf
typeset -i cpucount cpri
# echo "relance_en_cours $(date)" >>$FICLOG
for idf in $listfic; do
cpu_count ; cpucount=$?
if [[ $cpucount -ge $PLIMIT ]]; then
break
fi
cpri=$(awk -vmidf=$idf 'BEGIN { split(midf,a,/[.]/); print
a[2]; }' )
# Uniquement si la priorité est inférieure au paramètre fourni
if [[ $cpri -le $mprior ]]; then
# echo "tentative de relance pour $idf à $(date) args
$(cat $TEMDIR/$idf)" >>$FICLOG
lance_prof $(cat $TEMDIR/$idf)
fi
done
# echo "fin relance en cours $(date)" >>$FICLOG
mv relance.$mprior relance_en_cours >/dev/null 2>&1
fi
return 0
}
Any ideas would be gratefully received
Chris