Sunday, July 15, 2012

Subversion


Install Subversion that is the software for version control.

For this example, Use Subversion with WebDAV function, so httpd is required and SSL settings is also done.
[1] Install and Configure Subversion.
[root@www ~]#
yum -y install subversion mod_dav_svn
[root@www ~]#
vi /etc/httpd/conf.d/subversion.conf
# line 26-39: uncomment and change like follows


   DAV svn
   SVNParentPath /var/www/svn
# # Limit write permission to list of valid users.
  
      # Require SSL connection for password protection.
      SSLRequireSSL
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile
/etc/httpd/conf/.htpasswd

   
# specify access control file

     
AuthzSVNAccessFile /etc/svnusers

      Require valid-user
  
[root@www ~]#
vi /etc/svnusers
# set access right like an example below

[site:/]
# all users are writable

* = rw
# cent is writable

[site:/directory]
cent = rw
# userB is readable

userB = r
# userC is not permitted

userC =
[root@www ~]#
mkdir -p /var/www/svn/site

[root@www ~]#
svnadmin create /var/www/svn/site
 
# create a repository

[root@www ~]#
chown -R apache. /var/www/svn

[root@www ~]#
htpasswd -c /etc/httpd/conf/.htpasswd cent
 
# add a user

New password:
# set password

Re-type new password:
Adding password for user cent
[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[ OK ]

Starting httpd:
[ OK ]

Wednesday, July 11, 2012

beh - The Backend Error Handler

beh - The Backend Error Handler

Very annoying with CUPS is that when an error on the communication between the CUPS backend and the printer occurs, CUPS disables the print queue and to be able to continue printing an administrator (root access required) has to re-enable the queue. It is not enough to simply fix the printer's communication problem (like turning it on, fixing the network connection, ...).
This is especially a very bad design for desktop/home users. They often only turn on their printers when they really want to print (to save energy). Then it happens easily that they send a job and forget to turn on the printer. CUPS disables the queue and the annoying re-enabling procedure has to be done. And many users even do not know about the problem. So the printer does not print and the queue gets nuked and re-created. Or the people cry on the help forums or at the installation support of their distributions.
This problem can be easily worked around by installing beh, the Backend Error Handler. This script makes the handling of such backend errors configurable, so that the problem can easily be worked around. The new possibilities are:
  • Let queues simply not being disabled. Simple approach, but job gets lost.
  • Repeat a given number of times.
  • Repeat infinitely often, until the job gets finally through. This is the standard of LPRng, and it eliminates loss of the job.
  • The interval between two attempts to run the backend can also be configured.
  • Configuration is done independently for each print queue. So local printers and network printers can be treated differently.
Simply download the script, copy it into the CUPS backend directory (normally /usr/lib/cups/backend/), and make it executable with "chmod 755 beh. Then restart CUPS that it registers the new backend, usually with "killall -HUP cupsd" or "/etc/init.d/cups restart". If you did all correctly, there must be a line containing "beh" in the output of "lpinfo -v".
beh is a wrapper which is called by CUPS in place of the usual backend, which is called by beh now. This way beh can, depending on its configuration, repeat the call of the backend or simply hide the error status of the backend from being seen by the CUPS daemon.
To make a print queue using beh, get root and call a command as follows:
lpadmin -p -E -v beh:/

///
with
:
The name of your print queue
:
Don't Disable, if "1", beh always exits with zero status, so the queue gets never disabled when the original backend exits with an error. "0" carries the error status of the last call of the backend (after retries) on to CUPS, so the queue usually gets disabled.
:
Attempts, number of attempts to recall the backend in case of an error. "0" means infinite retries. In this case
gets meaningless.
:
Delay between two attempts to call the beckend, to be given in seconds and as an integer number. Meaningless if is one.
:
The original URI, which your queue had before (use "lpstat -v" to get your queue's URI shown).
All parameters, especially,
, , and have always to be specified, even if one of them is meaningless due to the setting of the others.
beh works with every backend except the hp backend from HPLIP. If beh is used with the hp backend, the HP Toolbox will not find the printers any more.
Example URIs:
beh:/1/3/5/socket://printer:9100
On the network printer with host name "printer" it is tried to access 3 times with 5 second delays between the attempts. If the job still fails, the queue is not disabled (and the job discarded).
beh:/0/10/60/socket://printer:9100
Retry 10 times in one minute intervals, disable the queue when still not succeeding.\