Tuesday, April 30, 2013

How to force comments on Subversion Commit with Perl hook script

Today i got a requirement from one of our senior developer to force a comments on svn commit.
We are using Subversion in linux.

We have to create a file pre-commit under /{repository-location}/hooks/
 

cd /{repository-location}/hooks/
touch pre-commit
chmod 775 pre-commit

Copy paste the following code in pre-commit file.

#!/usr/bin/perl

# config section
$minchars = 4;
$svnlook = '/usr/bin/svnlook';

#--------------------------------------------
$repos = $ARGV[0];
$txn = $ARGV[1];
$comment = `$svnlook log -t "$txn" "$repos"`;
chomp($comment);

if ( length($comment) == 0 ) {
  print STDERR "A comment is required!";
  exit(1);
  }
elsif ( length($comment) < $minchars ) {
  print STDERR "Comment must be at least $minchars characters.";
  exit(1);
  }

exit(0);

Tuesday, April 23, 2013

Sendmail not stating, some errors

While starting sendmail am getting some errors, and i can't see port 25 is opened.

[root@ip-10-190-51-120 ~]# /etc/init.d/sendmail start
Starting sendmail: -bd is not supported by sSMTP
                                                           [  OK  ]
[root@ip-10-190-51-120 ~]#

Fix: Uninstall ssmtp from the server

[root@ip-10-190-51-120 ~]# rpm -qa | grep ssmtp
ssmtp-2.61-19.el6.x86_64
[root@ip-10-190-51-120 ~]# rpm -e ssmtp-2.61-19.el6.x86_64
warning: /etc/ssmtp/ssmtp.conf saved as /etc/ssmtp/ssmtp.conf.rpmsave
[root@ip-10-190-51-120 ~]# rpm -qa | grep ssmtp
[root@ip-10-190-51-120 ~]#

This helps to solve this issue.

Friday, April 12, 2013

How to create a cron job with URL


Normally we have to give some commands at the end to execute cron jobs in a particular time. Today i need to execute the result of the url in cron job

01 04 * * * wget -O - -q -t 1 http://IP/Apps/Adminemail/admin_report

This helps.