Saturday, November 26, 2016

Troubleshooting logrotate and cron on Ubuntu server

My client's logrotate was not rotate the logs for months. However, manually run logrotate is fine. use debug, verbose, even force options can't find anything funny. The content of /var/lib/logrotate/status looks normal. Finally, check the cron job to see if anything wrong there.
  1. Tail /var/log/cron.log and see "Authentication token is no longer valid; new one required".
  2. Run "chage -l root" to check the aging information of root account, and "password must be changed" message shown up.
  3. Generate a new password from https://strongpasswordgenerator.com, then run passwd command to change to the new passwd for root. 
  4. Check /var/log/cron.log again after a cron job is executed, and the cron.log seems OK. The problem fixed.
Conclusion: Since the cron job is essential for automatic log rotation. If cron job has any problem, the log files don't get rotated even manual run has no problem at all.  


Friday, November 25, 2016

Speed test from Linux Command line

Run following 3 commands to do the test.
  1. wget -O speedtest https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
  2. chmod +x speedtest
  3. ./speedtest
Following is a sample test result:
Retrieving speedtest.net configuration...
Testing from DigitalOcean (x.x.x.x)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by fdcservers.net (New York City, NY) [2.13 km]: 5.872 ms
Testing download speed................................................................................
Download: 832.04 Mbit/s
Testing upload speed....................................................................................................
Upload: 485.81 Mbit/s