-
Create an empty file to prevent the service from starting
sudo touch /etc/cloud/cloud-init.disabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://download2.mikrotik.com/routeros/6.40.5/chr-6.40.5.img.zip -O chr.img.zip && \ | |
gunzip -c chr.img.zip > chr.img && \ | |
apt-get update && \ | |
apt install -y qemu-utils pv && \ | |
qemu-img convert chr.img -O qcow2 chr.qcow2 && \ | |
qemu-img resize chr.qcow2 `fdisk /dev/vda -l | head -n 1 | cut -d',' -f 2 | cut -d' ' -f 2` && \ | |
modprobe nbd && \ | |
qemu-nbd -c /dev/nbd0 chr.qcow2 && \ | |
echo "Give some time for qemu-nbd to be ready" && \ | |
sleep 2 && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function echo_mem_stat () { | |
mem_total="$(free | grep 'Mem:' | awk '{print $2}')" | |
free_mem="$(free | grep 'Mem:' | awk '{print $7}')" | |
mem_percentage=$(($free_mem * 100 / $mem_total)) | |
swap_total="$(free | grep 'Swap:' | awk '{print $2}')" | |
used_swap="$(free | grep 'Swap:' | awk '{print $3}')" | |
swap_percentage=$(($used_swap * 100 / $swap_total)) |