start_chromium.sh
· 2.6 KiB · Bash
Raw
#!/bin/sh
# RUN chromium in full screen with minimal SD-Card writes, runs OK on a Raspberry 3 with a webpage playing video
# ADD a ram disk in fstab with this line
# tmpfs /tmpcache tmpfs nodiratime,noatime,nosuid,nodev,size=256M 0 0
# and that this script is called on startup for a minimalistic (no desktop setup)
# /etc/xdg/openbox/autostart
# or (if you want to keep your desktop with other stuff)
# Insiide /home/pi/.config/lxsession/LXDE-pi
# @lxpanel --profile LXDE-pi
# @pcmanfm --desktop --profile LXDE-pi
# @xscreensaver -no-splash
# /home/pi/start_chromium_stats.sh > /var/log/auto_start_output_stats_browser.log 2>&1 &
export DISPLAY=:0
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
unclutter -idle 0.01 &
# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp
# Chromium keeps writing shit continuously in ~/.config/chromium
# BUT WE cannot kill it completely because Home Assistant requires a login to save
#mkdir /tmpcache/chromium_config_tmp
#rm -rf ~/.config/chromium/
#ln -s /tmpcache/chromium_config_tmp ~/.config/chromium
# Create links to RamDisk for most active files by chromium as observed using iotop / lsof
rm -rf /home/pi/.config/chromium/Default/IndexedDB
mkdir /tmpcache/IndexedDB
ln -s /tmpcache/IndexedDB /home/pi/.config/chromium/Default/IndexedDB
rm -rf /home/pi/.config/chromium/Default/GPUCache
mkdir /tmpcache/GPUCache
ln -s /tmpcache/GPUCache /home/pi/.config/chromium/Default/GPUCache
rm -rf "/home/pi/.config/chromium/Default/Local Extension Settings"
mkdir /tmpcache/ChromeLocalExtensionSetttings
ln -s /tmpcache/ChromeLocalExtensionSetttings "/home/pi/.config/chromium/Default/Local Extension Settings"
rm -rf "/home/pi/.config/chromium/Default/QuotaManager-journal"
mkdir /tmpcache/ChromeQuotaManager-journal
ln -s /tmpcache/ChromeQuotaManager-journal "/home/pi/.config/chromium/Default/QuotaManager-journal"
rm -rf "/home/pi/.config/chromium/Default/QuotaManager"
mkdir /tmpcache/ChromeQuotaManager
ln -s /tmpcache/ChromeQuotaManager "/home/pi/.config/chromium/Default/QuotaManager"
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
nice -n 5 chromium-browser --disk-cache-dir=/tmpcache --force-device-scale-factor=0.68 --disable-infobars --enable-features=OverlayScrollbar,OverlayScrollbarFlashAfterAnyScrollUpdate,OverlayScrollbarFlashWhenMouseEnter --kiosk 'http://192.168.0.182:8123/lovelace-telacheia/0'
1 | #!/bin/sh |
2 | |
3 | # RUN chromium in full screen with minimal SD-Card writes, runs OK on a Raspberry 3 with a webpage playing video |
4 | |
5 | # ADD a ram disk in fstab with this line |
6 | # tmpfs /tmpcache tmpfs nodiratime,noatime,nosuid,nodev,size=256M 0 0 |
7 | |
8 | # and that this script is called on startup for a minimalistic (no desktop setup) |
9 | # /etc/xdg/openbox/autostart |
10 | |
11 | # or (if you want to keep your desktop with other stuff) |
12 | # Insiide /home/pi/.config/lxsession/LXDE-pi |
13 | # @lxpanel --profile LXDE-pi |
14 | # @pcmanfm --desktop --profile LXDE-pi |
15 | # @xscreensaver -no-splash |
16 | # /home/pi/start_chromium_stats.sh > /var/log/auto_start_output_stats_browser.log 2>&1 & |
17 | |
18 | export DISPLAY=:0 |
19 | # Disable any form of screen saver / screen blanking / power management |
20 | xset s off |
21 | xset s noblank |
22 | xset -dpms |
23 | |
24 | unclutter -idle 0.01 & |
25 | |
26 | # Allow quitting the X server with CTRL-ATL-Backspace |
27 | setxkbmap -option terminate:ctrl_alt_bksp |
28 | |
29 | # Chromium keeps writing shit continuously in ~/.config/chromium |
30 | # BUT WE cannot kill it completely because Home Assistant requires a login to save |
31 | #mkdir /tmpcache/chromium_config_tmp |
32 | #rm -rf ~/.config/chromium/ |
33 | #ln -s /tmpcache/chromium_config_tmp ~/.config/chromium |
34 | |
35 | # Create links to RamDisk for most active files by chromium as observed using iotop / lsof |
36 | |
37 | rm -rf /home/pi/.config/chromium/Default/IndexedDB |
38 | mkdir /tmpcache/IndexedDB |
39 | ln -s /tmpcache/IndexedDB /home/pi/.config/chromium/Default/IndexedDB |
40 | |
41 | rm -rf /home/pi/.config/chromium/Default/GPUCache |
42 | mkdir /tmpcache/GPUCache |
43 | ln -s /tmpcache/GPUCache /home/pi/.config/chromium/Default/GPUCache |
44 | |
45 | rm -rf "/home/pi/.config/chromium/Default/Local Extension Settings" |
46 | mkdir /tmpcache/ChromeLocalExtensionSetttings |
47 | ln -s /tmpcache/ChromeLocalExtensionSetttings "/home/pi/.config/chromium/Default/Local Extension Settings" |
48 | |
49 | rm -rf "/home/pi/.config/chromium/Default/QuotaManager-journal" |
50 | mkdir /tmpcache/ChromeQuotaManager-journal |
51 | ln -s /tmpcache/ChromeQuotaManager-journal "/home/pi/.config/chromium/Default/QuotaManager-journal" |
52 | |
53 | rm -rf "/home/pi/.config/chromium/Default/QuotaManager" |
54 | mkdir /tmpcache/ChromeQuotaManager |
55 | ln -s /tmpcache/ChromeQuotaManager "/home/pi/.config/chromium/Default/QuotaManager" |
56 | |
57 | sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State' |
58 | sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences |
59 | nice -n 5 chromium-browser --disk-cache-dir=/tmpcache --force-device-scale-factor=0.68 --disable-infobars --enable-features=OverlayScrollbar,OverlayScrollbarFlashAfterAnyScrollUpdate,OverlayScrollbarFlashWhenMouseEnter --kiosk 'http://192.168.0.182:8123/lovelace-telacheia/0' |
60 | |
61 |