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 #!/bin/bash
rm -rf /root/.cache rm -rf /root/.cache
rm -rf /var/www/.cache rm -rf /home/{aur,firefish,mastodon}/.cache
rm -rf /home/{aur,jeremystartm,mastodon}/.cache
rm -rf /opt/owncast/.cache
echo ":: Purged all \".cache\" directories." echo ":: Purged all \".cache\" directories."

View file

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

View file

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
if [ ! -f "/bin/dpkg" ]; then if [ -f "/bin/dpkg" ]; then
echo ":: Error: You are not running a Debian based distro." 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 exit 1
fi fi
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

View file

@ -1,11 +1,5 @@
#!/bin/bash #!/bin/bash
echo ":: Pruning docker containers" echo ":: Pruning docker system"
docker container prune --force yes|docker system prune -a
echo ":: Pruning docker images" echo ":: Recreating traccar:custom"
docker image prune --force /opt/traccar-docker/build.sh
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