Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed After keyword. Creates a loop in systemd dependencies #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mkzram.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[Unit]
Description=Enable compressed swap in memory using zram
After=multi-user.target

[Service]
RemainAfterExit=yes
Expand All @@ -9,4 +8,4 @@ ExecStop=/usr/sbin/zramstop
Type=oneshot

[Install]
WantedBy=swap.target
WantedBy=multi-user.target
File renamed without changes.
2 changes: 1 addition & 1 deletion zramstart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ num_cpus=$(nproc)

last_cpu=$((num_cpus - 1))
FACTOR=33
[ -f /etc/sysconfig/zram ] && source /etc/sysconfig/zram || true
[ -f /etc/zram.conf ] && source /etc/zram.conf || true
factor=$FACTOR # percentage

memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ')
Expand Down
9 changes: 7 additions & 2 deletions zramstat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

ls /sys/block/zram* > /dev/null 2>&1 || exit 0

Expand All @@ -9,5 +9,10 @@ for i in /sys/block/zram*; do
if [ $compr -gt 0 ]; then
ratio=$(echo "scale=2; $orig*100/$compr" | bc -q)
fi
echo -e "/dev/${i/*\/}:\t$ratio% ($orig -> $compr)"
# echo -e "/dev/${i/*\/}:\t$ratio% ($orig -> $compr)"
echo -n -e "/dev/${i/*\/}:\t$ratio% ("
echo -n $orig | sed ':a;s/\B[0-9]\{3\}\>/.&/;ta'
echo -n " -> "
echo -n $compr | sed ':a;s/\B[0-9]\{3\}\>/.&/;ta'
echo ")"
done