mardi 31 octobre 2017

How to restart a script from a specific point?

Is there a way to make this script

#!/bin/bash

X=0

while true; do
    if [ $X -eq 10 ]; then
        sudo rm -r /var/log/daemon.log
        sudo rm -r /var/log/syslog
        sudo reboot
    fi

  expressvpn disconnect

    while timeout 2 ./typer; [ $? -eq 124 ]
    do
        exec $0
        let X++
    done
done

Restart from after the statement X=0 if the command times out so that the counter doesn't reset? I'm using exec $0 but it resets the counter every time I guess

Aucun commentaire:

Enregistrer un commentaire