Monday, June 15, 2009

How to run a crontab entry as "nobody"

Assuming you are the root user on a Linux computer, here's a quick example of how to run a program on a Linux system through a crontab entry, with the program being executed as the user nobody.

Just put this entry in a crontab file (by issuing the "crontab -e" command, for example), and the program named myProgram.sh will be run at 1:30 a.m. using the Bourne shell, and will be run as the user nobody.

30 1 * * * su -c '/path/to/program/myProgram.sh' -s /bin/sh nobody

testing is always recommended, but this has worked for me.

How to create aliases (linux/unix)

Creating aliases is very easy. You can either enter them at the command line as you're working, or more likely, you'll put them in one of your startup files, like your .bashrc file, so they will be available every time you log in.

I created the ll alias by entering the following command into my .bashrc file:

alias ll="ls -al"

/etc/bashrc


Monday, June 1, 2009

Restore a Mysql database from the server backup

root@testserver [/var/lib/mysql]# mysql testsite_support < /backup/cpbackup/weekly/testsite/mysql/testsite_support.sql