Linux: Systemd ignore console-setup settings

If you work on older Laptops and you use a Console only System Setup like on Debian there is a Bug on systemd and the console-setup package since years. After reboot all Font Settings seems gone. But the Settings are not real gone, cause systemd does not pull the settings on boot!

How to fix?

  • edit the crontab of root by

sudo su -
crontab -e

  • insert the /bin/setupcon command on „@reboot“ means on every boot!

@reboot     /bin/setupcon > /dev/null 2>&1 

  • save and exit, reboot now
  • now the PC should echo big Fonts for old eyes „Terminus 20×12 Frambuffermode“

 

Linux: Bash Script Time Saver Session Timer

If you use daily the Internet you know how fast the Time passes. The Internet Research can grab a lot of time without that you feel it. Thats wasted time!

For saving Time on Linux you display a Timer Message on the User Screen after some Time, which let you remark that XX Minutes are gone.

The Linux Tool who can offer this is called „gxmessage“

Howto:

  • Install gxmessage if not installed with $sudo apt-get install gxmessage
  • open the root Crontab with $crontab -e
  • Enter this code (Username = User!):

*/10 * * * *    sudo -u username DISPLAY=:0.0 gxmessage -center "Again 10 Minutes gone.." > /dev/null >2&1

  • After 10 Minutes left, the popup remind you to close your work or Internet Session
  • Perfect Tool for Children to remind them to close the Laptop
  • gxmessage time saver timer

Apache: Count Visits on Console

If you use a Webserver like Apache, you can use a small script to Analyse your Logs. Create a analyse-web.sh Script with:

 $sudo nano /home/user/analyse-web.sh 

insert:
#!/bin/bash
cat /var/log/apache2/access.log | awk '{ print $1 }' | sort | uniq -c
exit 0

System Output:
1573  www.domain2.de
3568  www.domain3.de
..

If you change the „$1“ to other value like „$8“ you will get the count of touched files or folders! This shows you attacks on single Files by abnormal high counts! You can use cron to run it every 15Minutes and send it to mailbox of a user. And this way does not need a PHP Tool with special PHP rights like webalizer or else..

FreeBSD: Monitor svn Updates

If you use the  svn subversion tool to update source tree or ports tree, you want to have a possibility to look back what was pulled, pushed and droped you can use a Log File to monitor the update scripts. This helps if you temporarily log out the Terminal Sessions for a Coffee break.

Howto:

  • Login to FreeBSD via SSH
  • Use a tmux program like screen or tmux, if not installed, then install it. This allows ongoing operations on disconnects
  • Run on the Terminal
    $tmux
  • Run
     $sudo svn update /usr/src > /home/updates/svn.log #exit STRG+B then press "d" detach
    
  • The svn script goes on at background and write the output to the svn.log
  • To read at realtime the log do
    $tail -f /home/updates/svn.log #remark this allow no interaction!
  • Later you can read the Log again to view what files were, dropped, updated, created. This helps to find MAJOR CHANGES!

FreeBSD: Current Version port upgrade fails with „portsnap extract“ bug

If you use the current „head“ Version (Release 12) of FreeBSD with a svn updated /usr/src path you could run into errors after updating the OS via buildworld from sources.

There’s a bug ahead Revision „r314099“ at the „portsnap“ lib that will stop on extracting the ports.tgz to /usr/ports!

Solution: Pull again sources to /usr/src with

$svn update /usr/src
$make buildworld
$make buildkernel
$make installkernel
$reboot
$mergemaster -p
$make installworld
$mergemaster -FiU
$reboot
$portsnap fetch update #again.. to update ports tree
$portupgrade -a
$reboot

This should work now, the failed portsnap extract function was a known bug. If you dont want to rebuild the system, you can use svn to update /usr/ports via svn repository. You can later rebuild the source OS again.

WordPress: Move Blog to new URL Domain HTTP HTTPS on the MYSQL Console

Info: Today most Search Engines prefer Blogs who are offering „HTTPS“ at the URL for secure direct connects to the Websites but this results a lot of headaches to the Website Developers.

To be effective you should know:

  • You have to offer HTTPS beside HTTP
  • You should use a validated Domain Certificate, most Domain Resellers offer them for FREE
  • You should know that NOT every FREE Certificate is TRUSTED by every Browser (green closed lock symbol at the adressbar)
  • You have to Develop Websites WITH variable Format output ( PC, Tablet, Smartphone, Smart-TV, Infoboxes,)
  • Design Websites and test 3:2, 4:3, 16:9, 21:9, Formats
  • Easy readable for handicapted People
  • Easy to print to PDF (Test Print Preview Page)
  • Test with different Browsers ( IE, Firefox, Midori, Chrome, Safari, Mobile Browsers like Webview, Silk) if you have no possibilities ask Friends to test

To move the Blog you must access the MySQL Server and the Blog Database! phpMyAdmin Admin Interface should NOT be used if you can use the Terminal for higher Security! If not access the phpMyAdmin Admin Weblogin only be Local IP!!!

MySQL Server:

  • Always remove Anonymous User!
  • Always replace the root User Account with a new one
  • Always use very long Database Passwords! minimum 12 digits !
  • Set if you can the Listen IP to localhost or Socket for the MYSQL Server, no one should be able to access the server via public IP. If you have a virtual Server without second IP install a Firewall like „ufw“ and block all Ports without 25, 80, 443!!

Database Changes:

  • Login to the Server via SSH and connect to the MySQL Server with $mysql -u databaseadmin -p
  • Enter following MySQL Commands:

 

mysql > use blogdatabasename;  #change to the blog database
mysql > UPDATE wp_posts SET guid = replace(guid, 'http://www.domain','https://www.domain');
mysql > UPDATE wp_posts SET post_content = replace(post_content, 'http://www.domain', 'https://www.domain');
mysql > UPDATE wp_options SET option_value = replace(option_value, 'http://www.domain', 'https://domain');
mysql > UPDATE wp_posts SET guid = replace(guid, 'http://www.domain','https://www.domain');
mysql > UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.domain','https://www.domain');
mysql > flush query cache; #force updates on the mysql server caches!
mysql > quit;

Testing:

  • Login into your Blog on WordPress and check results and view, save and change all basics settings again on area settings an reading, cause much files are often „cached“ by Browsers, Proxy’s or by Cache Plugins!
  • Change wp-config.php add this „define(‚FORCE_SSL_ADMIN‘, true);“ to force https for Admin Login.
  • Check the Widgets! Cause you can’t change all URL’s at the MySQL Database, cause the Widgets creates „dynamic“ URL-Path Entry’s!!!

Debian: Auto Update System Daily without special Tools

If you want to have a full automatic Update on your System then open a Gnome Terminal / Linux Console run (# Comments):

  • $sudo nano /root/update.sh
  • enter:

#/!bin/bash
apt-get update #pull updates
apt-get dist-upgrade -y  # install updates
apt-get clean #clean update database for next pull to have clean source urls
exit 0

  • save with CTRL+X # save+Exit
  • $sudo chmod 755 /root/update.sh # make able to run
  • Setup Timeplan:
  • $sudo su –  # change to root users console with environment
  • $crontab -e  # open root timer
  • enter:

@daily sh /root/update.sh > /dev/null 2>&1

save with CTRL+X and be happy the System pulls daily on midnight if online..