If the script uses bsd specific commands and syntax it would be normal to not run under sclae since it’s linux based.
If you’re using api calls it may also be that core uses the old depreciated rest api and scle uses the newer websocket api
I had put the command in my script and replaced it to “shutdown -p now”, but it shows the same error. I can not send screenshots in the posts as new user.
Press the </> button in the forums message editor toolbar, and then paste the complete contents of the script file at the designated spot. You do not need to upload the file, its contents is fine, since it’s just text.
#!/bin/bash
HOST1=192.168.1.14 #IP des ersten PC
HOST2=192.168.1.19 #IP des zweiten PC
HOST3=192.168.1.24 #IP des zweiten PC
HOST4=192.168.1.41 #IP des zweiten PC
HOST5=192.168.1.42 #IP des zweiten PC
ip_range=192.168.0. #Netzadresse des eigenen Netzwerkes ohne den Hostanteil
ip=40 #checke Netz ab IP-Adresse 40
_exit () {
case $1 in
1) echo "Kein Shutdown - Mindestens einer der PCs ist eingeschaltet" ;;
2) echo "Kein PC online - Shutdown" ; /usr/bin/midclt call system.shutdown “Sleep” ;;
esac
exit $1;
}
# Checken ob PC's an sind
if [ `ping -c 1 -i 1 $HOST1 | grep -wc 100.0%` -eq 0 ] || [ `ping -c 1 -i 1 $HOST2 | grep -wc 100.0%` -eq 0 ] || [ `ping -c 1 -i 1 $HOST3 | grep -wc 100.0%` -eq 0 ] || [ `ping -c 1 -i 1 $HOST4 | grep -wc 100.0%` -eq 0 ] || [ `ping -c 1 -i 1 $HOST5 | grep -wc 100.0%` -eq 0 ] ;
then _exit 1; # abbrechen, ein PC läuft
# Wenn kein PC an ist, gehe zu Checken ob PC's im IP-Bereich an sind
else
# Checken ob PC's im IP-Bereich an sind
while [ $ip -le 45 ] #checke Netz bis Hostanteil 45
do
ping -c 1 -i 1 $ip_range$ip #ping mit der zusammengesetzten IP-Adresse aus den o.a. Variablen "ip" und "i"
if [ `ping -c 1 -i 1 $ip_range$ip | grep -wc 100.0%` -eq 0 ] #sobald einer der Hosts auf den ping antwortet, nicht herunterfahren
then _exit 1 #beenden mit exit 1 (kein shutdown)
fi
ip=$(( $ip+1 )) #erhöhe Hostanteil immer um 1
done
_exit 2 # hat kein PC geantwortet, shutdown
fi
Can you take a look to my script? If i put the command in the cron directly, it goes on. But with this i can’t control the Shutdown over the Script. I had tried to put the command in a blank script, it gives also an Error.