Wednesday, October 31, 2018

Mac Terminal timeout with SSH - Solved!

If you're like me and have a bajillion things open on your machine, it's a real PITA to have a SSH session timing out after a couple minutes of inactivity. Maybe in certain scenarios this is beneficial, but when I'm on my personal laptop at home, it's not a security risk.

At any rate, it's a really simple fix and it requires the creation/editing of a local user ssh config file.


Add lines:

Host *  ServerAliveInterval 60

Save and Exit.

Just tweak some permissions and you'll be good to go.

chmod 600 ~/.ssh/config
That's pretty much it.


Monday, February 26, 2018

Troubleshooting Cron (Cron not working)

I had a very curious case on a developmental server where after a couple weeks, I realized the cronjobs were not running. The crontab was fine, the scripts and permissions were fine and could be manually executed. Seems like the issue was cron itself.

It took a bit of digging, and there was this obscure line highlighted in the man page. Much thanks to here for pointing me in the right direction.

Two things were wrong here.

1. The crond was stalled. Quietly. Check this first and start it if it's stopped. Even if it's running, consider restarting the service.
service crond status
service crond restart

2. Crontab needs an empty/newline at the end of the file in order to load.
My version of crontab does not match the one in the article (I'm on CentOS 6); but the newline was missing at the end. Oddly enough all the other servers that were fine had this blank/newline. Guess it's pretty important, if not documented/deprecated.

At any rate, cron performs important user functions, so consider checking it from time to time.