tech

Cheat Sheet: systemctl vs chkconfig

Since I've mostly been using Red Hat or the gui desktop of Ubuntu lately I've neglected to notice the transitions from the sysVinit packages to systemd. Recently I installed Fedora 16 and was a little surprised when chkconfig didn't work anymore. I decided I would write a post that gives the systemctl version of a few common chkconfig commands. List processes chkconfig: # chkconfig --list systemd: # systemctl list-units Enable a service chkconfig:

When it's Ok and Not Ok to use rc.local

On System V based OS's the /etc/rc.local file is executed by the init process at the end of the systems boot process. The fact that the rc.local file is executed during the boot process makes it an easy target for misuse by lazy Sysadmins. Since I started my Unix experience on FreeBSD which relies primarily on the /etc/rc.* configuration files, I've seen and shamefully contributed to my fair share of misuse in the rc.

MySQL: tee saving your output to a file

Tee is a unix command that takes the standard out output of a Unix command and writes it to both your terminal and a file. Until recently I never knew there was a MySQL client command that performed the same function. Today I will show you an example of how to use it. First login to the MySQL CLI (command line interface) $ mysql -uroot -p Enter password: Welcome to the MySQL monitor.

Creating a new filesystem with fdisk, lvm, and mkfs

Our Task: Create a new 10GB filesystem to store a package repository for yum Challenges: The existing hard drive has been fully allocated using LVM. Solution: Add a new hard drive to the server (virtual server in this case) Partition the drive and add it to the main logical volume Create a new filesystem This article assumes that by now you have physically added the hard drive to the server.

Creating a read-only backup user for mysqldump

Mysqldump is a great utility for backing up or exporting a database to a flat file. This flat file can then be used to import the database or databases into another mysql database or even another database server like postgre depending on the options you use. To perform a very simple backup of the mysql database you can simply just setup a cronjob that runs mysqldump at whatever interval you want.

How to check if a cron job ran

Cron is a time based scheduled task daemon that runs on most common Unix/Linux distributions. Because cronjobs are time based sometimes it is necessary to validate that the job ran at the scheduled time. Sometimes people will configure a cron to send the output of the script to a user via system mail or redirect the output to a file; however not all crons are setup the same and many times they may be configured to send output to /dev/null hindering any ability to validate the job ran.

dscacheutil: Clearing DNS cache on OSX

This is something I ran into recently over the weekend. I made modifications to the DNS of a domain and I couldn't get my mac to recognize the change. The culprit was DNS caching, after flushing my DNS cache all was well. # dscacheutil -flushcache

mysql: Creating a db and user

While the specific commands below were used to create a test database for wordpress the same commands will apply for most situations where you want to create a mysql database and a user with appropriate privileges to that database. $ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 39304 Server version: 5.1.54-1ubuntu4 (Ubuntu) First log into the mysql command line interface using the mysql command.

gzip: Restoring original filename

I can't say this has happened to me often but recently the question came up on whether or not gzip retains the original filename. Here are the commands necessary to not only find the original filename but uncompress the file with its original filename. Identifying: [email protected]:~/Downloads$ gzip datacenter-me.jpg [email protected]:~/Downloads$ gzip -l datacenter-me.jpg.gz compressed uncompressed ratio uncompressed_name 23386 23392 0.2% datacenter-me.jpg As you can see from the above the filename is stored in the gzip file.

bind: Checking a zone record for errors

Bind is the most widely used DNS service software out there, it is the default DNS service for all of the main distributions of Unix/Linux. While Bind is very popular it is also very tricky sometimes. One of the best ways to see if your edits are good and meet the DNS standards is to run a named-checkzone after editing a zone file and before reloading/restarting bind. slize:~# named-checkzone bencane.com /etc/bind/master/bencane.