Friday, June 29, 2007

add svn repository

1. add one svn user and group

$ useradd svn -c "SVN Owner" -s /bin/false
(-c comment, -s shell , here no shell access)

2. If we want more than one repository then add group for each one.

$ groupadd reposgp
$ usermod -G reposgp svn
(Add this group to svn user/group)

3. Create a Subversion repository

We are creating it at /var ; svn will be the folder containing all repos
$ install -v -m 0755 -o svn -g svn -d /var/svn
$ svnadmin create --fs-type fsfs /var/svn/repos

(Here 'repos' will be our repos)

Now we can import some files/dir to the repos

$ svn import -m "Initial import." /path/to/source/tree
file:///var/svn/repos


Now change owner and group information on the repository, and add
an unprivileged user to the svn and reposgp groups:

$ chown -R svn:odotgp /var/svn/repos
$ chmod -R g+w /var/svn/repos
$ chmod g+s /var/svn/repos/db
$ usermod -G svn,repsogp sanjay

(here sanjay is already a user in the system)

We can verify the existing groups of user with the commands

$ groups sanjay

Monday, June 18, 2007

Regular Expressions

Regular Expression:

^ : Matches the Beginning of string
$ : Matches the End of string
(): Parentheses, define the scope and precedence of Operators

Quantification: How often the preceding expression is allowed
There are 3: ?, * and +

?: 0 or 1 [ colou?r will match color or colour ]
*: 0, 1 or any number [ go*gol will match ggol, gogol, googol, gooogol etc ]
+: at least 1 [ go+gol = gogol, googol, gooogol etc ]

{n}: Repeat n times the previous exp

Examples:

1xx : ^1[0-9]{x}
21xx or 22xx: ^2[12][0-9]{2}
3xxxxxxxxxx, 4xxxxxxxxx, 9xxxxxxxxx (10 digits telephone number starting with 3, 4 or 9)
^[349][0-9]{9}

Thursday, June 14, 2007

Setting a Crontab

Syntax:

* * * * * command

# Use the hash sign to prefix a comment
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed


Crontab Example
_______

A line in crontab file like below removes the tmp files from /home/someuser/tmp each day at 6:30 PM.

30 18 * * * rm /home/someuser/tmp/*

Changing the parameter values as below will cause this command to run at different time schedule below :

min hour day/month month day/week Execution time
30 0 1 1,6,12 * -- 00:30 Hrs on 1st of Jan, June & Dec.

:

0 20 * 10 1-5 --8.00 PM every weekday (Mon-Fri) only in Oct.

:

0 0 1,10,15 * * -- midnight on 1st ,10th & 15th of month

:

5,10 0 10 * 1 -- At 12.05,12.10 every Monday & on 10th of every month
:

By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

>/dev/null 2>&1

Whats new in Ajuby 0.5