Skip to main content
GrN.dk

Main navigation

  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

Linux

By Greg Nowak, 10 February, 2022

Delete Files and Folders Older Than X days

find /[FOLDER_NAME]/* -mtime +[OLDER_THAN_DAYS] -exec rm -rf {} \;

Example deletes all files and folders in tmp folder that are older than 180 days: find /tmp/* -mtime +180 -exec rm -rf {} \;

Tags

  • bash
  • Script
  • Linux
By Greg Nowak, 1 October, 2021

Check defined constants - PHP Code Snippet

<?php 

define('DISALLOW_FILE_EDIT', true);

echo "\n DISALLOW_FILE_EDIT is: " . constant('DISALLOW_FILE_EDIT') . "\n";

//$constants = get_defined_constants();
//var_dump($constants); // pretty large list
?>

Key words: define defined constant constants

Tags

  • Script
  • php
  • Linux
  • server
By Greg Nowak, 23 September, 2021

Ubuntu Logs Journalctl and Dmesg

You can see a lot of good information for debugging and fixing errors on your Ubuntu server with journalctl and dmesg

journalctl --since "1 days ago"

journalctl --since "10 hours ago"

journalctl --since "12 hours ago" -p 3 -x --utc --no-pager

dmesg | less

dmesg -H --time-format iso| less

Resources:

https://unix.stackexchange.com/questions/50098/linux-network-troublesho…

Tags

  • Linux
  • logistics
  • Script
By Greg Nowak, 23 September, 2021

Wordpress Cron

Wordpress runs it's cron job automatically approximately every 10 minutes. Sometimes it is blocked by .htaccess or other server configuration. To avoid issues, it might be a good idea to run from the server crontab itself.

References:

https://kinsta.com/knowledgebase/disable-wp-cron/

https://wpbeaches.com/set-up-wordpress-wp-cron-php-to-run-manually/

Tags

  • wordpress
  • Linux
  • Script
By Greg Nowak, 22 September, 2021

Bash Find and Delete Files Older Than X Days

find [FOLDER_NAME]/* -prune -mtime +14 -exec rm {} \;

Tags

  • Script
  • Linux
By Greg Nowak, 6 September, 2021

Nagios Check HTTP notes

Example bash on argument 1. It checks if HTTPS is up and if the domain-name is on the site. Most sites have the domain name on the front page somewhere: /usr/local/nagios/libexec/check_http -H $1 --ssl --onredirect=follow --string "$1"

If log file you can run grep on the following keywords: grep -i -e "critical" -e "invalid" -e "warning"  [LOGFILE.log]

Keywords: check_http

Tags

  • Script
  • Linux
  • Web
By Greg Nowak, 24 August, 2021

Ubuntu Linux Flush DNS Cache

sudo resolvectl flush-caches

Before Ubuntu 22.04

Check DNS cache status: sudo systemd-resolve --statistics

Flush DNS cache: sudo systemd-resolve --flush-caches

Tags

  • Linux
  • Script
By Greg Nowak, 11 August, 2021

Remove whoopsie-upload

sudo systemctl stop apport
sudo systemctl stop whoopsie 
sudo systemctl disable apport
sudo systemctl disable whoopsie
sudo aptitude purge apport whoopsie

Source: https://askubuntu.com/questions/1245078/woopsie-upload-all-process-cons…

Tags

  • Linux
By Greg Nowak, 11 August, 2021

SystemD Notes Tips and Tricks

A nice little guide: https://tecadmin.net/run-shell-script-as-systemd-service/

Tags

  • Linux
  • Script
By Greg Nowak, 10 August, 2021

Skype For Linux Fix High CPU Consumption

Possible fix:

Delete the cache: ~/.config/skypeforlinux/Cache/

Skype start command: nice -n 19 rm -r ~/.config/skypeforlinux/Cache/* ; nice -n 19 /usr/bin/skypeforlinux %U skypeforlinux --disable-accelerated-video-decode=true

Skype start command vanilla: /usr/bin/skypeforlinux %U

Tags

  • Linux

Pagination

  • 1
  • Next page
Linux

Review Greg on Google

Greg Nowak Google Reviews

 

  • Portfolio
  • About Greg Nowak
  • Gregs IT and Logistics Optimization
  • Shrink PDF In Linux
  • Running Linux on T450s T495s T14, Thinkpads and Others
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.