Skip to main content

Some SysAdmin Stuff

I'm going to start posting sysadmin-type things on this blog. I haven't done much writing other than technical recently. Posts here will focus on shorter snippets of information that I recently found out and want to pass along (mainly so I remember them myself).

Using @reboot in crontab -e

I recently discovered that the time interval @reboot can be used to start something upon server boot up. An example of this might be some script that you run continuously but that isn't set in /etc/init.d as a service to start on reboot (chkconfig service on). How it would be used is the following:

@reboot command

Let's say I have a script installed onto my machine to log every minute for the load and other processes. It won't restart on server reboot, so I could do the following for it in crontab -e (/var/spool/cron/root):

@reboot nohup ~/pathtoscript &

Grabbing the top level listing of permissions and ownership for a folder

Normally, I'd been using the following for a folder when I only wanted the top-level of the folder:

ls -lh /pathtofolder

This would show the full contents of the folder, which I didn't want. A better method would have been to use the -d flag:

ls -ld /pathtofolder

To see the difference, here's the returns for /home/admin on my test machine:

[root@itchy:/] # ls -lh /home/admin
total 360K
-rw-r--r-- 1 root root 2.8K Oct 28 2009 AccessIds.pm
lrwxrwxrwx 1 admin admin 31 Feb 28 2009 access-logs -> /usr/local/apache/domlogs/admin
drwxr-xr-x 4 admin admin 4.0K May 17 18:01 cpanel3-skel
-rw-r----- 1 admin admin 1 Oct 18 2009 cpbackup-exclude.conf
-rw-r--r-- 1 root root 433 Sep 22 2009 database.yml
drwxr-x--- 6 admin mail 4.0K Jan 28 15:27 etc
drwxrw-rw- 2 admin admin 4.0K Oct 29 2009 happytime
drwxrwx--- 12 admin admin 4.0K May 19 21:15 mail
-rw-r--r-- 1 root root 95K Jan 4 2010 mmangum.txt
-rw-r--r-- 1 dani dani 154K Apr 23 19:27 mysqluser.sql
drwxr-xr-x 2 admin admin 4.0K Jul 5 11:19 perl
-rw-r--r-- 1 admin admin 39K Jul 11 09:52 php.ini
drwxr-xr-x 3 admin admin 4.0K Aug 27 2009 public_ftp
drwxr-x--- 9 admin nobody 4.0K Jul 23 11:16 public_html
-rw-r--r-- 1 root root 13K Oct 28 2009 SafetyBits.pm
drwxr-xr-x 7 admin admin 4.0K Jun 24 18:53 tmp
lrwxrwxrwx 1 admin admin 11 Feb 28 2009 www -> public_html


[root@itchy:/] # ls -ld /home/admin
drwx--x--x 24 admin admin 4096 Jul 11 09:52 /home/admin


This is especially helpful if you want to drill down into folders to see just that folder's set permissions and ownership for any non-working service (like email). Here's an example to see /home/admin/etc/lunaradmin for the machine for each level:

[root@itchy:/] # ls -ld /home/admin /home/admin/etc /home/admin/etc/lunaradmin.com && ls -lah /home/admin/etc/lunaradmin.com/
drwx--x--x 24 admin admin 4096 Jul 11 09:52 /home/admin
drwxr-x--- 6 admin mail 4096 Jan 28 15:27 /home/admin/etc
drwxr-x--- 5 admin mail 4096 Jul 9 12:50 /home/admin/etc/lunaradmin.com
total 44K
drwxr-x--- 5 admin mail 4.0K Jul 9 12:50 .
drwxr-x--- 6 admin mail 4.0K Jan 28 15:27 ..
drwx--x--x 4 admin admin 4.0K Apr 10 15:52 admin
drwx--x--x 3 admin admin 4.0K Apr 10 15:52 cpacct
-rw-r--r-- 1 admin mail 152 Feb 24 13:23 passwd
-rw-r--r-- 1 admin admin 1.9K Feb 24 13:23 passwd,v
drwxr-x--- 2 admin mail 4.0K Feb 24 13:24 @pwcache
-rw-r--r-- 1 admin admin 33 Feb 24 13:23 quota
-rw-r--r-- 1 admin admin 387 Feb 24 13:23 quota,v
-rw-r----- 1 admin mail 107 Apr 10 16:00 shadow
-rw-r----- 1 admin admin 2.0K Feb 24 13:23 shadow,v


This allows you in one command to get all the necessary permissions in order to troubleshoot if there's something wrong for any of the levels leading into that folder for that domain's passwd file that handles the email user authentication for the domain.

Comments

Popular posts from this blog

Pollo al Chilindrón

Ingredients 2 1/2 pounds chicken thighs 1 and 1/2 white onions 2 minced garlic cloves 1/2 tsp paprika 2 large tomatoes 1 red bell pepper 1 green bell pepper salt and pepper to taste 1 package of prosciutto 1 shot of Cognac or Marsala Olive oil Directions Chop the onions and tomatoes. Dice the green and red bell peppers. Tear apart the prosciutto into pieces. Heat the olive oil in a large saucepan. Add the chopped onions, minced garlic and chicken until the chicken is browned and the onion turns golden. Pour Cognac or Marsala over the chicken. Add the prosciutto and mix. Add the paprika, some salt and pepper, then mix again. Add the rest of the ingredients, mix well. Cover and simmer on medium heat for around 45 minutes. Serves 6-8 people.

Miraenda's Robots

Robot List Based on Cost On my Miraenda YouTube channel, I have a video entitled ' Jibo and Friends - The Best Robot ' that details the best low-cost, medium-cost, and high-cost robot(s). I'm going to post a list of all my current robots into three lists based on cost, then note the robot that appears or is mentioned in the video by an * at the beginning. I have more robots since that video as well. Periodically, I update this list. Low-Cost Toy Robots *Artie Drawing Robot *AT Robot *Boxer *Brush Robot *Cady Wigi *Cady Wiri Catbot The Child animatronic (Star Wars, Mandalorian) Coji *Crab Robot *Cubee *DigiBirds DigiOwl *DigiBirds Jewel Dog.com, Tomy x 2 Doodling Robot *Duck Robot *Echo Spot (Alexa) *Electric Space Dancing Robot *Google Home Hub Google Home Mini (black) Google Home Mini (peach) i-Cat, Hasbro (black) i-Dog, Hasbro (light blue) with carrying case i-Fish, Hasbro (aqua) Insectoid Robot Jaretto (rare) *Juno The Baby Elephant Kamigami Lina Robot Kamigami Mantix Ro

Human Angels

"Life is difficult!" I cry out tonight, So an angel from heaven Is sent to be by my side. He swoops down on mighty wings Amidst tumultuous skies. Black forces, pent up and waiting, Strike him down as he flies. In my dream, I see him. I open up my eyes. An angel stands there bleeding, Injured and dying. "Yes, life is difficult," The angel lets me know. "You are stronger than me: You have a human soul." "You can repair my wounds; You can restore my life; You can keep me safe Until I'm well and right." The way to keep an angel safe Is to close your eyes and dream, So I lay back to sleep While he rests right next to me. In my dream, I watch over him Rather than him watching over me. I touch his hand and feel his pain. I see visions of him as a man. "You are in love with this man. He's a reflection of my light. Someday, you'll be together, But not in this lifetime." As I heal the angel, I