Nextcloud - upgrade from CLI

Published on Author admin

Upgrading Nextcloud from CLI. /var/www/html/owncloud/ - Nextcloud installation directory apache - HTTP server service user cd /var/www/html/ wget https://download.nextcloud.com/server/prereleases/nextcloud-12.0.1RC4.zip service httpd stop rm owncloud-old/ -rf mv owncloud/ owncloud-old/ unzip nextcloud-12.0.1RC4.zip mv nextcloud/ owncloud/ mv owncloud-old/data/ owncloud/data/ cp owncloud-old/config/config.php owncloud/config/config.php chown apache: owncloud/ -R cd owncloud sudo -u apache php occ upgrade service httpd start

Bash swap function for swapping two files

Published on Author admin

Put following function definition code into ~/.bashrc file: function swap()         {     local TEMPFILENAME=tempfile.$$     mv "$1" $TEMPFILENAME && mv "$2" "$1" && mv $TEMPFILENAME $2 } Usage: swap FILE1 FILE2 This solution was originally found at: https://stackoverflow.com/questions/1115904/shortest-way-to-swap-two-files-in-bash/1115909#1115909

Port forwarding using HAproxy

Published on Author admin

HAproxy can be used not only for complex load-balancing scenarios, but also for simple port forwarding. Useful for forwarding packets originating from both local and external hosts. listen postgresql 0.0.0.0:5432     mode tcp     stats enable     balance roundrobin     server postgresql-db 192.168.0.1:5432 check

SSH connection inside while Bash loop

Published on Author admin

When using SSH connection inside while Bash loop, there is need to redirect SSH input to /dev/null, as SSH reads standard input by default: #!/bin/bash while read IP; do echo $IP; ssh root@$IP -C hostname < /dev/null; echo "" done < ip.txt Contnet of ip.txt file: 192.168.0.10 192.168.0.11 192.168.0.12