shutdown_linux
This is an old revision of the document!
Table of Contents
Sovol SV06+ (mostly)
Klipper Shutdown
Linux version
hs110_off
#!/bin/sh python tplink_smartplug.py -t 192.168.1.60 -c off
hs110_on
#!/bin/sh python tplink_smartplug.py -t 192.168.1.60 -c on
mks_poweroff
#!/bin/bash # Install plink (allows passwords given on commandline) # apt install putty-tools # To use a ssh key: # Adjust PLINKKEY so it points to your private key # (generated with "puttygen" when using putty, or with "ssh-keygen" for default ssh) # Using ssh instead of plink is possible when using a ssh key instead of a clear text password: # Set PLINKCMD=ssh # === best practice is using a PLINKKEY instead of a cleartext PASSWORD === PRINTER=mkspi USERNAME=mks PASSWORD=makerbase PLINKCMD=plink PLINKKEY= # options for plink with putty key (puttygen) #PASSWORD= #PLINKKEY=printer.ppk # options for standard ssh (ssh-keygen) #PASSWORD= #PLINKKEY=~/.ssh/printer_priv #PLINKCMD=ssh # === nothing should be changed below here === # MKSPI: allow user "mks" to shutdown/reboot/halt (without "sudo" asking for a password): # add following to /etc/sudoers.conf (run "visudo"): # mks ALL=NOPASSWD: /sbin/halt, /sbin/reboot, /sbin/poweroff POWERCMD="sudo poweroff" if [ "$PLINKCMD" == "plink" ]; then OPTBATCH=-batch fi if [ ! -z $PLINKKEY ]; then OPTKEY="-i $PLINKKEY" fi if [ ! -z $PASSWORD ]; then OPTPW="-pw $PASSWORD" POWERCMD="echo $PASSWORD|sudo -S poweroff" fi $PLINKCMD $OPTPW $OPTKEY $OPTBATCH $USERNAME@$PRINTER $POWERCMD
shutdown_sv06
#!/bin/bash
PRINTER=mkspi
# try to ping MKSPI, shut it down, if it responds
if ping -c 1 -W 1 $PRINTER >/dev/null; then
echo Shutting down MKSPI
bash mks_poweroff
echo -n Waiting for MKS to shutdown.
# ping MKSPI, until it stops responding
while ping -c 1 -W 1 $PRINTER >/dev/null; do
echo -n .
sleep 1
done
# not responding any longer
echo MKSPI has shut down.
echo Waiting additional 7 seconds...
sleep 7
fi
echo Power off HS110 smartplug...
bash hs110_off
Back to shutdown
Back to start
shutdown_linux.1732707578.txt.gz · Last modified: 2024/11/27 12:39 by torte
