Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
kill vlc after suspend
[Unit]
Description=Kills VLC on resume in order to fix logging spam
[Service]
Type=oneshot
ExecStart=-/usr/bin/killall vlc
TimeoutSec=0
StandardOutput=syslog
After=suspend.target
[Install]
WantedBy=multi-user.target sleep.target
sudo cp kill_vlc_on_resume.service /etc/systemd/system/
sudo systemctl enable kill_vlc_on_resume.service --now
@rubo77
Copy link

rubo77 commented Feb 8, 2021

download and install with

sudo wget https://gist.githubusercontent.com/Red-Eyed/0fdaae7876254dccf4396f33aa1a8875/raw/cd0c31b6e33109250f0c9614855129edd997d1a3/1.%2520kill_vlc_on_resume.service -O /etc/systemd/system/kill_vlc_on_resume.service
sudo systemctl enable kill_vlc_on_resume.service --now
# remove the huge blob in /var/log/syslog
F=/var/log/syslog; X=1000; head -n $X $F > /tmp/tmpfile && mv /tmp/tmpfile $F

@rubo77
Copy link

rubo77 commented Feb 8, 2021

This question came original up here: https://unix.stackexchange.com/a/627519/20661

Wouldn't it be more wise to just empty /var/log/syslog on resume instead of killing VLC?
I created another gist: https://gist.github.com/rubo77/2fe1fef2ff7f5bdd60a88a835f0c5573#file-1-truncate_syslog_after_resume-service

@BoboTiG
Copy link

BoboTiG commented Aug 23, 2021

Thanks a lot!

@Red-Eyed
Copy link
Author

Red-Eyed commented Aug 25, 2021

This question came original up here: https://unix.stackexchange.com/a/627519/20661

Wouldn't it be more wise to just empty /var/log/syslog on resume instead of killing VLC?
I created another gist: https://gist.github.com/rubo77/2fe1fef2ff7f5bdd60a88a835f0c5573#file-1-truncate_syslog_after_resume-service

No, it wouldn't, because we don't want to miss all the logs because of buggy VLC

@leberknecht
Copy link

leberknecht commented Mar 28, 2022

@rubo77 on linux systems, wget's -o option means logfile location. For output path, its uppercase -O :)

@rubo77
Copy link

rubo77 commented Mar 30, 2022

@leberknecht thanks, I corrected my comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment