Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (24 sloc) 515 Bytes
#!/bin/sh -eu
#
# Run the Chromium web browser in a sandbox, opening a new window,
# limiting memory usage to half the available memory or 1 GiB max.
#
# Written in 2011 by Suraj N. Kurapati <https://github.com/sunaku>
memory=$(
free --bytes | awk '
BEGIN {
GiB = 2 ^ 30
print 1 * GiB
}
/Mem:/ {
total=$2
avail=$7
print total/2
print avail/2
}
' | sort -n | head -1
)
exec \
nice \
prlimit --data=$memory --rss=$memory \
/usr/bin/chromium --new-window "$@"