Optimize scripts

This commit is contained in:
The StarOpenSource Project 2023-09-13 03:17:37 +02:00
parent 3a6916e1b3
commit d9a1fd797d
4 changed files with 15 additions and 20 deletions

View file

@ -1,6 +1,4 @@
#!/bin/bash
rm -rf /root/.cache
rm -rf /var/www/.cache
rm -rf /home/{aur,jeremystartm,mastodon}/.cache
rm -rf /opt/owncast/.cache
rm -rf /home/{aur,firefish,mastodon}/.cache
echo ":: Purged all \".cache\" directories."

View file

@ -1,7 +1,7 @@
#!/bin/bash
echo ":: Cleaning up..."
export "diskusage_precleanup=$(df -h /)"
export "diskusage_precleanup_bytes=$(df /)"
export "diskusage_precleanup=$(df -h /data)"
export "diskusage_precleanup_bytes=$(df /data)"
soscmd-prune
soscmd-cache
soscmd-bleachbit
@ -9,8 +9,8 @@ echo ":: Cleanup successful."
echo -e "\n:: Disk usage before cleanup:"
echo "$diskusage_precleanup"
echo ":: after cleanup:"
df -h /
df -h /data
echo -e "\n:: And here in measured in bytes, before cleanup:"
echo "$diskusage_precleanup_bytes"
echo ":: and after:"
df /
df /data

View file

@ -1,6 +1,9 @@
#!/bin/bash
if [ ! -f "/bin/dpkg" ]; then
echo ":: Error: You are not running a Debian based distro."
if [ -f "/bin/dpkg" ]; then
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
elif [ -f "/bin/pacman" ] && [ -f "/bin/pacman-key" ]; then
LC_ALL=C pacman -Qi | awk '/^Name/{name=$3} /^Installed Size/{print $4$5, name}' | sort -h
else
echo ":: Error: You are not running a Debian or Arch Linux based distro."
exit 1
fi
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

View file

@ -1,11 +1,5 @@
#!/bin/bash
echo ":: Pruning docker containers"
docker container prune --force
echo ":: Pruning docker images"
docker image prune --force
echo ":: Pruning docker volumes"
docker volume prune --force
echo ":: Pruning docker networks"
docker network prune --force
echo ":: Adding required docker networks"
docker network create runner0
echo ":: Pruning docker system"
yes|docker system prune -a
echo ":: Recreating traccar:custom"
/opt/traccar-docker/build.sh