Terrible one-liner to make this easier to remember;
for i in $(varnishadm vcl.list | grep cold | awk '{print $4}') ; do varnishadm "vcl.discard $i" ; done
Terrible one-liner to make this easier to remember;
for i in $(varnishadm vcl.list | grep cold | awk '{print $4}') ; do varnishadm "vcl.discard $i" ; done
Shamelessly stolen from wikipedia because they’re thinking about removing this, as “Wikipedia is not a howto”. *sigh*.
With kernel version 3.5 and over, as well as kernel version 2.6.32-303 and over, it is likely better to use 1 for cases where 0 used to be optimal.
To temporarily set the swappiness in Linux, write the desired value (e.g. 10) to /proc/sys/vm/swappiness using the following command, running as root user:
# Set the swappiness value as root echo 10 > /proc/sys/vm/swappiness # Alternatively, run this sysctl -w vm.swappiness=10 # Verify the change cat /proc/sys/vm/swappiness 10 # Alternatively, verify the change sysctl vm.swappiness vm.swappiness = 10
Permanent changes are made in /etc/sysctl.conf via the following configuration line (inserted, if not present):
vm.swappiness = 10
10 is generally good for ‘I don’t want swapping to happen except if you *really* need it.
Are you getting a weird error from varnish that you’re having trouble working out? Is it cryptically saying that there’s an issue with your host definition in your VCL?
Expected ID got ';' (program line 165), at ('input' Line 20 Pos 30) .first_byte_timeout = 120; -----------------------------#
You need to add a time unit to your timeout definitions — ‘s’ for seconds, ‘m’ for minutes. Stupid cryptic error is dumbly cryptic. Grrr.
https://varnish-cache.org/lists/pipermail/varnish-bugs/2011-August/003983.html
So, you have a Varnish server running systemd, which is behind a reverse proxy for SSL like nginx, and you can’t work out how to make varnishncsa log IP addresses from a specified header? Well, it’s a bit of a pain in the neck really. You need to override the systemd service file, which is like systemd’s version of the init scripts. Due to it being systemd, this is not just a case of editing a file…
For Debian, you can use the service file below, and paste it into
/etc/systemd/system/varnishncsa.service
Once done, you need to reload systemd’s service listing itself;
$ systemctl daemon-reload
Congratulations, you now have varnishncsa logs including the visitor’s real IP address, as specified by Nginx. Change the name in “{X-Forwarded-For}” to change the header name, for example if you want CloudFlare’s view of the client’s IP address, use “CF-Connecting-IP”
[Service] RuntimeDirectory=varnishncsa Type=forking PIDFile=/run/varnishncsa/varnishncsa.pid User=varnishlog Group=varnish ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -D -P /run/varnishncsa/varnishncsa.pid -F '%%{X-Forwarded-For}i %%l %%u %%t "%%r" %%s %%b "%%{Referer}i" "%%{User-agent}i"' ExecReload=/bin/kill -HUP $MAINPID
If you get an error like:
Fatal error: Call to a member function select() on a non-object in /home/username/public_html/app/code/community/Fishpig/Wordpress/Model/Resource/Page.php on line 119
Then, check you’ve not just changed a MySQL username, without updating the fishpig configuration, or otherwise Fishpig can’t access the MySQL database for some reason. It seems to store a MySQL login in Magento config. I’ve not yet found exactly where, I’ll update this post with more once I understand more about what it’s doing.
It presented as the main Magento site throwing the following error:
exception ‘Zend_Exception’ with message ‘dbModel read resource does not implement Zend_Db_Adapter_Abstract’
Which it seems that most everyone will tell you to clear your cache to fix. You *will* need to clear your cache, probably. Just, after fixing the MySQL connection issue.
The following line is to make it easier for people googling to find this post:
Fatal error: Call to a member function select() on a non-object in /public_html/app/code/community/Fishpig/Wordpress/Model/Resource/Page.php on line 119 magento fishpig
This post my making sure https://xkcd.com/979/ doesn’t happen from me.
Well, I’ve now debugged a few issues with my scripts from my last post.
(made them a bit more fault tolerant and actually take notice of $? exit statuses) .
Recap: Temperhum (USB) -> Raspberry Pi -> Xively chart, now also
RFDuino (bluetooth wireless) -> Raspberry Pi -> Xively chart
Tip: If you’re struggling with the bluetooth on linux giving rx timeout errors (check the syslog if it’s not in the console),
update the software with the following commands:
sudo apt-get update sudo apt-get upgrade
The Rfduino has been sitting next to my usb Temperature and Humidity sensor for a few weeks collecting data.
Since it had been both collecting data for a few weeks and sending them to Xively / Pachube / Cosm, I had a quick look to see how closely the readings match.
The graphs do show correlation, thank goodness, but it looks like the RFDuino’s temperature scale isn’t right. The RFDuino is only updating the graph once a minute whereas the Temperhum is 2x a minute.
I didn’t really expect great accuracy for the RFduino thermometer seeing as it’s measuring from the chip. But this would still be useful in some more basic cases.
I think next on the roadmap for the RFduino is connecting sensors/remote controls (it would be cool to attach my RelaySockets to this and control the 2 connected relays via bluetooth from my Pi and Android smartphone!
My Humidity and Temperature sensor
A Temperhum from PCSensor.
A great little bit of kit – once you work out the conversion values for the C++ USB/i2c/HID code that lets linux talk to the thing!
Hi all, I was having trouble installing Mythubuntu 12.04 on an old PC I had lying around.
Mythubuntu is based on Ubuntu 12.04 so if you’re struggling with the ATI Radeon 9200 on there these steps should help.
(Since I have a Hauppuage Nova-T 500 dual freeview pci card from old projects, and a 2tb drive from new ones, I wanted to see about recording some films!)
Basically, when booting it would come up with a garbled, black or blank screen.
If this happens during the livecd boot, preventing you from installing, when you see the logo:
Hit enter, and F6 for other options, select nomodeset, hit enter to enable then Escape and enter to boot.
If operating from a laptop, you might want to try noapic too.
In the latest grub setup – grub 2 – the boot menu is hidden, making it near impossible to access.
Might make it look pretty but is major frustrating for troubleshooting!
The script /boot/grub/grub.cfg it uses is supposed to boot in textmode if it has failed to boot, but this does not work.
The fix:
Note: you can login, type
sudo su
and then skip typing sudo with every command below (it gets quite annoying I know!)
sudo nmcli -p con up id “Wired connection 1”
If that doesn’t work check your wireless connections names with and edit the above command appropriately
nmcli con
sudo apt-get install xserver-xorg-video-ati
(don’t freak out when you see ‘Removing Mythubuntu-desktop’ it seems to come right in the end.
sudo ln /usr/bin/Xorg /usr/bin/X
sudo nano /etc/default/grub.cfg
Change this line near the top:
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
to
GRUB_CMDLINE_LINUX_DEFAULT=”nomodeset”
#”quiet splash”
The # tells it to ignore this bit, it’s a backup so that we can make it quiet again later. You’ll notice text streaming by as the system boots instead of the cute (Myth) Ubuntu …. logo
Ctrl-X to exit, type s and Return to save
sudo update-grub
sudo reboot
I actually ran this command to to start the windows manager, (and I haven’t tried rebooting yet, shhh)
sudo start lightdm
If you have any extra trouble, comment below, check the ubuntu forums and google.
I managed to work this out on my own as I couldn’t find the answer!
I also created a script to set the resolution of lightdm at boot, following the guide here:
LightDM Resolution
This did not work as when I started lightdm, the resolution was set higher than I’d set in lightdm, so I don’t think this was part of the fix.
Thankfully it was within my monitors capabilities. I think I set the output name wrong.
I need to figure out the display outputs are available but couldn’t query it from the command line without x running, which seems kinda silly.
Hope this has been helpful!
To make du not traverse partitons, just run it with the -x flag, or –one-file-system. Shiny.
(For the google meister, next time I search; du don’t follow partiton)
..
My friend Nick has also reminded me you can use the -x flag on cp as well, which is handy 🙂
This is the second half of that magento issue. Mainly, after having got a directory with millions of files in it, you can do one of two things.
mv sessions sessions_full && mkdir sessions && chown www-data:www-data sessions
rm -rfv sessions_full
Or
find /loc/of/sessions -ctime +1 -type f -exec rm -v {} \;
After an upgrade, I’ve noticed a few times that bind has refused to restart or reload, saying:
Stopping domain name service: namedrndc: connect failed: connection refused
This seems to be a permissions bug in debian, quite a long lasting one. In order to cheat-fix it quickly, I do the following:
chown bind:root /etc/bind/rndc.key
chmod 660
/etc/init.d/bind9 restart
That seems to fix it well enough. I think it’s a problem in that bind starts as one user, but runs as another. It may be that 440 are all the perms that are necessary. The debian bug report is here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=169577