Add host scripts
This commit is contained in:
16
host/config.yaml
Normal file
16
host/config.yaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
debug: false
|
||||||
|
port: 8123
|
||||||
|
listeners:
|
||||||
|
/startbackup:
|
||||||
|
command: bash
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- "cd /root/qvalet; ./start_backup.sh"
|
||||||
|
return: output
|
||||||
|
|
||||||
|
/stopbackup:
|
||||||
|
command: bash
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- "cd /root/qvalet; ./stop_backup.sh"
|
||||||
|
return: output
|
||||||
12
host/start_backup.sh
Normal file
12
host/start_backup.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
value=$(<backups_amount)
|
||||||
|
newvalue=$((value+1))
|
||||||
|
if [[ $newvalue -lt 1 ]]
|
||||||
|
then
|
||||||
|
newvalue=1
|
||||||
|
fi
|
||||||
|
echo "Amount of running backups: $newvalue"
|
||||||
|
echo $newvalue > backups_amount
|
||||||
|
qm start 103
|
||||||
|
qm list | grep 103 | awk '{print $3}'
|
||||||
19
host/stop_backup.sh
Normal file
19
host/stop_backup.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
value=$(<backups_amount)
|
||||||
|
newvalue=$((value-1))
|
||||||
|
|
||||||
|
if [[ $newvalue -lt 0 ]]
|
||||||
|
then
|
||||||
|
newvalue=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $newvalue > backups_amount
|
||||||
|
if [[ $newvalue -gt 0 ]]
|
||||||
|
then
|
||||||
|
echo "A backup is still running"
|
||||||
|
else
|
||||||
|
echo "Stopping VM"
|
||||||
|
qm shutdown 103 --timeout 300
|
||||||
|
qm list | grep 103 | awk '{print $3}'
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user