1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830
|
<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>More 2 Cent Tips & Tricks Issue 21</title>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0020F0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>
"</H4>
<P> <hr> <P>
<!-- QUICK TIPS SECTION ================================================== -->
<center>
<H1><A NAME="tips"><IMG ALIGN=MIDDLE ALT="" SRC="../gx/twocent.gif">
More 2¢ Tips!</A></H1> <BR>
Send Linux Tips and Tricks to <A HREF="mailto:gazette@ssc.com">
gazette@ssc.com
</A></center>
<p><hr><p>
<H3>Contents:</H3>
<ul>
<li><a href="./lg_tips21.html#video">Changing Video Modes</a>
<li><a href="./lg_tips21.html#colormap">Colormap Questions</a>
<li><a HREF="./lg_tips21.html#netcat">Netcat!</a>
<li><a HREF="./lg_tips21.html#starting">Starting and Stopping Services</a>
<li><a HREF="./lg_tips21.html#tool">A New Tool for Linux</a>
<li><a HREF="./lg_tips21.html#logs">Of Logs and Other Things</a>
<li><a HREF="./lg_tips21.html#calc">Calculator Tip</a>
<li><a HREF="./lg_tips21.html#tarred">Another Way to View Tarred Files</a>
<li><a HREF="./lg_tips21.html#script">Script Ease</a>
<li><a HREF="./lg_tips21.html#syslog">Syslog Thing</a>
<li><a HREF="./lg_tips21.html#fax">Sorta E-mail-to-FAx...Well, to-Printer</a>
<li><a HREF="./lg_tips21.html#xterm">Setting Xterm Title to Current Process</a>
<li><a HREF="./lg_tips21.html#cvs">CVS</a>
</ul>
<P> <hr> <P>
<!--================================================================-->
<a name="video"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Changing Video Modes
</H3>
<P>
Date: Fri, 08 Aug 1997 22:41:05 -0600<br>
From: Michael J. Hammel <a href="mailto:mjhammel@csn.net">mjhammel@csn.net</a><br>
<P>I don't know how AccelX and XiGraphics and MetroX handle these things.
<P>AccelX is ( I think) a PC graphics company. You might mean Xaccel,
which is the actual program name for Xi Graphics X server. Its product
name is "AcceleratedX". Xi Graphics is the company name.
<P>As for how Xaccel changes its video modes - try CTRL-ALT-+ (thats a plus
sign). I believe that cycles through the various modes. Check the man
pages or manual to be certain. I believe MetroX does similar, but the
keystroke is probably different.
<P>--
<P> <hr> <P>
<!--================================================================-->
<a name="colormap"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Colormap Question
</H3>
<P>
Date: Fri, 08 Aug 1997 23:47:31 -0600<br>
From: Michael J. Hammel <a href="mailto:mjhammel@csn.net">mjhammel@csn.net</a><br>
<p>The question was "can you force an X application to use its own colormap
in some way other than using a command line option". The answer is: it
depends (aint it always the case?).
<p>An applications ability to use its own colormap is not a "builtin" part
of X. Colormaps are part of X, but the application still has to add
code to make use of colormaps. So if the application doesn't have any
code specifically for handling colormaps (for example, my XPostitPlus
doesn't have any such code) then neither the command line or any other
method will force it to use a private colormap. The default for
applications (like XPostitPlus) is to use the default colormap, and
thats why you often see applications with weird colors that you can't
get rid of till you exit some other application.
<p>Now, if the application *does* have code to deal with colormaps, it can
also make the use of the private colormap a user configurable option. X
provides a mechanism for making an option either a command line option
(eg. -usePrivateColormap) or an X resource. X resources can be
specified in X resource files (like .Xdefaults) or on the command line
using the -xrm option. X is so configurable that the number of ways for
a user to supply configuration information can often be quite confusing,
both for the user and the developer. In any case, its up to the
programmer to make any of these methods available. None is available by
default simply becaue its "an X windows program".
<p>The correct thing for an application to do is to allow the user to
configure the use of the private colormap in at least one way and to
provide a best-guess default for determining if a private colormap would
be the best thing to do or not if the user doesn't provide a
preference. Few applications do this, however. The GIMP does. So do
XV and Netscape. Even my own programs aren't very good at this,
although I intend to get much better in the very near future.
<p>As for an X column, well, I'd love to see one. We just need to convince
some X hack to spend a little time writing articles instead of code.
Thats kinda hard to do. I'll probably be adding some X coding tidbits
to my Muse column, but only with respect to using Motif or OpenGL in
graphical and multimedia applications.
<p>Hope this helps a little.
<p>
--
Michael
<P> <hr> <P>
<!--================================================================-->
<a name="netcat"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Netcat!
</H3>
<P>
Date: 01 Aug 1997 15:46 EDT<br>
From: Jean-Philippe Sugarbroad <a href="mailto:da1wizard@geocities.com">da1wizard@geocities.com</a>
<p>I was going through back issues of the Linux Gazette and I remembered a program
I use quite frequently... netcat. This program enables you to open sockets and
connect or listen with them - all from a shell script! It's a great way to
quickly fetch web pages or see if a server is running... It even has UDP
'connection' mode and zero-io mode (which closes the connection as soon as it
succeeds...). The UDP mode even uses a TCP connection to check round-trip time
:) I love it!
<p>Jean-Philippe Sugarbroad
<P> <hr> <P>
<!--================================================================-->
<a name="starting"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Starting and Stopping Services
</H3>
<P>
Date: Tue, 5 Aug 1997 18:55:19 -0600 (CST)<br>
From: Terrence Martin <a href="mailto:twm139@its.to">twm139@its.to</a><br>
<p>I was just reading the August version of Linux Journal and I noticed
refrence to rebooting the system after making changes to the
/etc/syslog.conf file in order for those changes to take affect. This is
contrary to a feature that is the main reason I use Linux at home and at
work.
<p>It is only generally necessary to reboot Linux to add/remove hardware or
when installing a new kernel. In the specific case of syslogd(8) you can
inform the server to reread it's initialization file by sending it a
SIGHUP signal.
<pre>
eg.
kill -HUP `cat /var/run/syslogd.pid`
</pre>
<p>This will work with many of the servers available for Linux including
(most) httpd(8), named(8), and inetd(8).
<p>Sometimes however it is preferable to actually restart these services. In
Slackware I believe most of your services are placed in a single script
and this makes it a little more difficult to pick and choose which
services to stop and start.
<p>In RedHat it is a little more modular. In the directory /etc/rc.d/init.d
are the scripts that are run on bootup to start various services.
<p>These scripts allow you to start and stop various services just as if you
had shutdown and rebooted your machine. eg.
<pre>
# /etc/rc.d/init.d/named.init stop
# /etc/rc.d/init.d/named.init start
</pre>
<p>This will start and stop the name service.
<p>The scripts supplied with RedHat are not too complex compared to similar
scripts I have seen on other systems. They can usually be adapted to new
services that you may wish to have start on bootup, without complicating
the rc.local file and giving you much finer control.
<p>If you examine the soft links in /etc/rc.d/rc0.d through /etc/rc.d/rc6.d
you will notice that they link to the files in /etc/rc.d/init.d. Each of
these numbers on these directories refer to a "runlevel".
<p>As the system boots the /etc/inittab tells the init process which
directories to examine to determine which services to start up, most
systems not running xdm will end at runlevel 3, otherwise it is runlevel
5.
<p>All of the files(softlinks) in runlevel 3 beginning with 'S' are executed
in order of occurance in the directory, this is controlled by giving each
a number ie
<pre>
S30syslog -> ../init.d/syslog comes before
S40cron -> ../init.d/cron.init.</pre>
Note: Links with the same number are executed in lexical order.
<p>The sequence may be important depending what services depend on other
services.
<p>I put most of the services I add in runlevel 3, as I usually boot into
multiuser mode. You then should add the approriate script link to
/etc/rc6.d as those are the files that are executed on shutdown. Note the
convention here is to begin all soft link names with 'K'. ie
<pre>K10named.init -> ../init.d/named.init</pre>
<p>Again these scripts are executed on order with the highest number being
last to run.
<p>The net effect of all these links is that with an 'S' preceding the soft
link the script is run with the argument "start" and with a 'K' it is run
with the argument "stop".
<p>Over the last two weeks I have set up and configured a news server, web
server, name server, sshd server, updated the syslog.conf file plus a
hundred other little tweaks on our RedHat 4.x box and I have not had to
reboot once. In fact the system has not been rebooted since we added a new
CPU and SCSI card 31 days ago...I love Linux :)...
<p>Regards<br>
Terrence Martin
<P><HR><P>
<!--================================================================-->
<a name="tool"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
A New Tool for Linux
</H3>
<P>
Date: Fri, 22 Aug 1997 08:29:59 -0500<br>
From: Ian <a href="mailto:Beth13@mail.utexas.edu">Beth13@mail.utexas.edu</a>
<p>The version posted in issue 20 assumes you have exec access to ALL dirs
under the one you 'TREE'
<p>Here's a modified version which works even in cases of unreadable
folders:
<pre>
-------------------------------- cut here --------------
#!/bin/sh
# @(#) tree 1.1 30/11/95 by Jordi Sanfeliu
# email: mikaku@arrakis.es
#
# Initial version: 1.0 30/11/95
# Next version : 1.1 24/02/97 Now, with symbolic links
# Patch by : Ian Kjos, to support unsearchable dirs
# email: beth13@mail.utexas.edu
#
# Tree is a tool for view the directory tree (obvious :-) )
#
search () {
for dir in `echo *`
do
if [ -d $dir ] ; then
zz=0
while [ $zz != $deep ]
do
echo -n "| "
zz=`expr $zz + 1`
done
if [ -L $dir ] ; then
echo "+---$dir" `ls -l $dir | sed 's/^.*'$dir' //'`
else
echo "+---$dir"
if cd $dir ; then
deep=`expr $deep + 1`
search # with recursivity ;-)
numdirs=`expr $numdirs + 1`
fi
fi
fi
done
cd ..
if [ $deep ] ; then
swfi=1
fi
deep=`expr $deep - 1`
}
# - Main -
if [ $# = 0 ] ; then
cd `pwd`
else
cd $1
fi
echo "Initial directory = `pwd`"
swfi=0
deep=0
numdirs=0
zz=0
while [ $swfi != 1 ]
do
search
done
echo "Total directories = $numdirs"
-------------------------------- cut here --------------
</pre>
<p>The changes are to put the "cd $dir" as the predicate of an IF
statement, NOT IN A SUBSHELL, and the recursive part is the switched
clause. This prevents infinite recursion in the case of an unreadable or
unexecable dir.
<P> <hr> <P>
<!--================================================================-->
<a name="logs"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Of Logs and Other Things
</H3>
<P>
Date: Sun, 10 Aug 1997 21:47:39 +0200<br>
From: D. Emilio Grimaldo T. <a href="mailto:grimaldo@panama.iaehv.nl">grimaldo@panama.iaehv.nl</a><br>
<p>Hi,<br>
I recently saw on the August issue of Linux Gazzete and some
previous issues about the handling of system logs. Well, it
doesn't have to be complicated, in fact I have written a very
useful script/package that has been around for a couple of
years, it is called Chklogs and is used by major network providers,
companies and small-time users of Linux systems. In fact it is
going to be featured in the Linux Journal some time this year.
IT fulfills all the log handling needs. For more information
see
<a href="http://www.iaehv.nl/users/grimaldo/info/">http://www.iaehv.nl/users/grimaldo/info/</a>
<p>Catch the link to Chklogs
<p> Best Regards,<br>
Emilio
<P> <hr> <P>
<!--================================================================-->
<a name="calc"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Calculator Tip</H3>
<P>
Date: Sun, 27 Jul 1997 23:43:37 +0200 (MET DST)
From: Hans Zoebelein <a href="mailto:zocki@goldfish.cube.net">zocki@goldfish.cube.net</a><br>
<p>Hello Linux Gazetters,<br>
Here comes a real cheap command line calculator.
Since shell scripts do only integer calculation,
you are stuck if you want floating point precision.
<p>You also want to do sometimes stuff like 'how much is
1200*3/7' at the commandline without firing up a full
blown GUI calculator.
<p>Just for that work you can use the <tt>calcme</tt> command line
calculator, which is hacked in perl. Dont forget that a shell
thinks differently about 10*3 than a calculator. So do it as
10\*3 or "10*3".
<p>The icing of the cake is the optional formatting. If you supply
something like <tt>%.3f</tt> as second parameter, the output is nicely
formatted as floating point number and up/down rounded correctly
after 3 decimals.
<p>You also can do a <tt>calc 10/3 %20.6f</tt> which returns a string
with 6 digits and 20-6=14 spaces like <tt>______________3.3333</tt>.
So formatting of lists in shell scripts is real fun now.
<p>Enjoy!<br>
Hans
<pre>#!/usr/bin/perl
#
# The ultimate command line calculator :-^
# Usage calcme <string_to_calculate> [<output_format>]
#
# Input is a string like (10+3)/7 or "(10 + 3) / 7"
# Output is the calculated result of the string (sic!).
# Optional formatting can supplied as 2nd parameter.
if (@ARGV == 0 || @ARGV > 2)
{
die("Usage: $0 <\"formula_to_calculate\"> [<output_format>]\n");
}
$format = "";
$calcme = $ARGV[0];
(@ARGV == 2) && ($format = $ARGV[1]);
$output = eval($calcme);
if(@ARGV == 1)
{
print(STDOUT "$output\n");
}
else
{
printf(STDOUT "$format\n", $output);
}
exit(0);
</pre>
<p>
--
Hans
<P> <hr> <P>
<!--================================================================-->
<a name="tarred"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Another Way to View Tarred Files</H3>
<P>
Date: Sat, 02 Aug 1997 02:18:07 +1000 (GST)
From: Gerald J Arce <a href="mailto:garce@starcommand.mang.net">garce@starcommand.mang.net</a>
<p>In issue 19, I read a 2 cents tip regarding viewing a tarred file.
I use less instead..
<pre>
ex:
tar tzf foo.tar.gz
less foo.tar.gz
</pre>
Less typing (grin).
<P> <hr> <P>
<!--================================================================-->
<a name="script"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Script Ease </H3>
<P>
Date: Wed, 6 Aug 1997 01:54:19 +0200 (GMT+0200)
From: Trucza Csaba <a href="mailto:ctrucza@cemc.soroscj.ro">ctrucza@cemc.soroscj.ro</a>
<p>Hi all,
<p>As a programmer-wannabe, I do a lot of typing. To ease at least the
beginning of each source file (which is mainly the same: include-s,
define-s, imports and stuff), I wrote a script to automatize this. For
the quality of the script please read the notice at the end of my mail.
<pre>(file: se)
---------cut here---------------
#!/bin/sh
#
# source editor (se)
#
# usage: se <filename> <type>
#
# WARNINGS:
# 1. do not supply extension:
# se MyProg.java will make a MyProg.java.java!!!
#
# 2. manually create the
# SE_HOME_DIR,
# SE_HOME_DIR/temp,
# SE_HOME_DIR/templates
#
# man se:
#
# create two files for each type of the source you want to se.
# the script will copy the first file+filename+second file into a new
# file (you got it?:-)
#
# so: if you want java, create two files:
#
# templates/java.1:
#
# ---8<---
# public class
# --->8---
# (Do not put a newline at the end!)
#
# templates/java.2
#
# ---8<---
# {
# public static void main(String args[]){
# }
# }
# --->8---
#
# the script for se MyProg java (or jus se MyProg if the last time you
# used java as type) will create a new file called MyProg.java:
#
# public class MyProg
# {
# public static void main(String args[]){
# }
# }
#
# examine and modify at will
#
# author: Trucza Csaba ctrucza@cemc.soroscj.ro
#
# this script may be full of errors
#
SE_HOME_DIR=~/.source-editor
LAST_USED=$SE_HOME_DIR/last_used
if [ -f $LAST_USED ] ; then
SE_DEFAULT_TYPE=`cat $LAST_USED`
fi
case $# in
0)
echo "no parameter"
if [ -z $SE_DEFAULT_TYPE ] ; then
SE_DEFAULT_TYPE=java
fi
FILE_TYPE=$SE_DEFAULT_TYPE
FILENAME=~/.source-editor/temp/temp.$FILE_TYPE
;;
1)
echo "filename"
if [ -z $SE_DEFAULT_TYPE ] ; then
SE_DEFAULT_TYPE=java
fi
FILE_TYPE=$SE_DEFAULT_TYPE
FILENAME=$1.$FILE_TYPE
;;
2)
echo "name and type"
FILE_TYPE=$2
FILENAME=$1.$FILE_TYPE
;;
esac
echo "FILE_TYPE="$FILE_TYPE
echo "FILENAME="$FILENAME
if [ -f $FILENAME ]; then
echo file exists
else
build-template $FILE_TYPE $1
mv ~/.source-editor/templates/$FILE_TYPE.template $FILENAME
fi
echo $FILENAME
echo $FILE_TYPE > $LAST_USED
jstar -tab 4 $FILENAME
---------cut here---------------
</pre>
<p>The second script is a simple backup script, to back all the sources up
and edit the tracking file.
<pre>(file: backup)
---------cut here---------------
#!/bin/sh
#
# kind of backup with kind of version control
# usage: backup
#
# backs up the current directory (well not all of it, just your
# programs)
#
# 1. creates a dir named backup (or whatever)
# 2. in this directory will be a tracking file, a plain text file
# in which you can write some comments every backup
# 3. optionally in the file named filelist you can write the names of
# the files you want to back up
# 4. examine and modify at will
#
# author: Trucza Csaba ctrucza@cemc.soroscj.ro
#
# this script may be full of errors
#
#
# where to back up
#
if [ -z $BACKUPDIR ] ; then
BACKUPDIR=backup
fi
if [ ! -d $BACKUPDIR ] ; then
mkdir $BACKUPDIR
fi
#
# last version backed up
#
LAST_FILE=$BACKUPDIR/last
if [ -f $LAST_FILE ] ; then
VERSION=`cat <$LAST_FILE`
else
VERSION=0
fi
let VERSION=$VERSION+1
#
# prepare next backup directory
#
NEXT_DIR=$BACKUPDIR/ver.$VERSION
mkdir $NEXT_DIR
#
# get files to back up
#
LIST_FILE=$BACKUPDIR/filelist
if [ -f $LIST_FILE ] ; then
cp `cat $LIST_FILE` $NEXT_DIR
else
#
# if no filelist found, backup C and Java files
# modify as you wish
#
cp *.c $NEXT_DIR >/dev/null 2>&1
cp *.h $NEXT_DIR >/dev/null 2>&1
cp *.java $NEXT_DIR >/dev/null 2>&1
fi
#
# update last
#
echo $VERSION >$LAST_FILE
#
# edit trackfile
#
TRACK=$BACKUPDIR/track
echo >> $TRACK
echo >> $TRACK
echo "=====================================================================">> $TRACK
date >> $TRACK
echo "Version: "$VERSION >>$TRACK
#
# here use your favorite editor :)
#
jstar $TRACK
---------cut here---------------
</pre>
<p>They should be self-explanatory.
but,
These scripts should not be used for design or development of nuclear,
chemical, biological, weapons or missile technology, or any other places
where humans can be hurt
<P> <hr> <P>
<!--================================================================-->
<a name="syslog"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Syslog Thing</H3>
<P>
Date: Thu, 07 Aug 1997 15:00:29 -0700<br>
From: Kent Friis <a href="mailto:dk5f@ehs.dk">dk5f@ehs.dk</a>
<p>In issue 20, I saw a 2c tip regarding syslog, Including changing the config
file, and REBOOTING. Now wait a minute, I thought this was Linux. How can
one get uptime's of 300+ days, if you need to reboot every time you change
a config file.
<p>The solution is simply to edit the config file, and kill -HUP (pid of
syslogd).
<p>You should NEVER need to reboot, except to install a new kernel.
<p>Kent Friis.
<P> <hr> <P>
<!--================================================================-->
<a name="fax"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Sorta E-mail-to-Fax...Well to-Printer</H3>
<P>
Date: Fri, 8 Aug 1997 20:04:30 +0500 (PKT)<br>
From: Tee Emm <a href="mailto:tm@super.net.pk">tm@super.net.pk</a>
<p>Hello,
<p>I can bet that many of you readers will try out this tip atleast for once.
Here we go:
<p>I work at an ISP here in Pakistan with 4 more shift engineers. We have
offices in three different locations and, although email and talk are
used very frequently, we sometime require ABSOLUTELY IMMEDIATE responce
from the other office. Emails remain unchecked and talk request are
sometimes ignored because the other party might be busy doing something
else on a talk-disabled terminal. Well, you cannot ignore a Panasonic
Dotmatrix printer printing out messages in your control center!
<p>One of my so-to-say boss talked of having a utility which will poll a POP3
mailbox every few seconds and printing out any mail that might be in the
box. He, being a visual basic guru, started writing a windows based
application that would do the required. I, being a die hard Linux
creature, started thinking how I can do the same on my dear Linux box.
Well, it took me a day to ponder on this issue and when I clicked, it was
just a breeze! Sixteen key strokes and I was ready with my system. I
yelled 'Windoz Suxs, Linux Rules'!
<p>I edited the /etc/aliases file and keyed in the following line:
<pre>
urgent: "| lpr"
</pre>
saved, the file and did a 'newaliases' and bingo! Any mail sent to
urgent@super.net.pk was immediately printed on the screaming dot matrix
printer. My boss was duly stunned!
<p>(Note: You must have your 'lpr' command working before you can go ahead
with this tip.)
<p>Tariq Mustafa,
<P> <hr> <P>
<!--================================================================-->
<a name="xterm"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
Setting Xterm Title to Current Process</H3>
<P>
Date: Tue, 12 Aug 1997 01:09:02 -0500 (CDT)<br>
From: Rob Mayoff <a href="mailto:mayoff@dqd.com">mayoff@dqd.com</a><br>
<p>I saw this tip the Gazette:
<B>Hi, after searching (to no avail) for a way to display the currently
executing process in the xterm on the xterm's title bar, I resorted to
changing the source of bash2.0 to do what I wanted. from line 117 of
eval.c in the source, add the lines marked with # (but don't include
the #)</B>
<p>If you use ksh instead of bash, you can get the same effect
without changing the source:
<pre>typeset -A Keytable
trap -- 'eval "${Keytable[${.sh.edchar}]}"' KEYBD
[[ "$TERM" == xterm ]] && \
Keytable[$'\r']=$'[[ -n ${.sh.edtext} ]] && print -n "\E]2;${.sh.edtext}\a"'
</pre>
<p>You can download ksh (the POSIX-compliant Korn shell) for free from
<a href="http://www.research.att.com/orgs/ssr/book/reuse">http://www.research.att.com/orgs/ssr/book/reuse</a>
<P> <hr> <P>
<!--================================================================-->
<a name="cvs"></a>
<H3><IMG ALIGN=BOTTOM ALT="" SRC="../gx/lil2cent.gif">
CVS</H3>
<P>
Date: Thu, 14 Aug 1997 11:08:27 -0400<br>
From: Paul Rensing <a href="mailto:paulr@dragonsys.com">paulr@dragonsys.com</a>
<P><B>Mario Storti wrote:</B>
<P><B>Using shar + RCS to Backup Set of Source Files</B>
<p><B>Hi, RCS (see rcs(1)) is a very useful tool that allows to store versions of
a file by storing only the differences between successive versions. In this
way I can make a large amounts of backups of my source files but with a
negligible amount of storage. I use it all the time, even for TeX files!!
However, when you are working with a set of source files (*.c, shell or
Perl scripts, I work mainly with Fortran .f and Octave *.m files) what I
want is to make backups of the whole set of files in such a way that you
can recover the state of the whole package at a given time. I know that
there is a script called rcsfreeze around, but I know that it has problems,
for instance if you rename, delete or create new files, it is not
guaranteed to recover the same state of the whole set.</B>
<p>I think a good way to handle this is by "upgrading" to CVS. CVS is a version
control system built on top of RCS and was designed specifically to handle
version control of large trees of files (the company who wrote it was a Sun
VAR and handled the > 1000 files which they regularly received from Sun).
<p>Once you have the project set up, you could simply do "cvs commit" from the
top directory of a project, and CVS will check in all the changes to all the
controlled files in the tree. If you are using this for "backup", you would
only need to keep a copy of the CVS "repository".
<p>Paul Rensing
<P> <hr> <P>
<!--================================================================-->
<center>Published in Linux Gazette Issue 21, September 1997</center>
<P> <hr> <P>
<!--================================================================-->
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif" ALT="[ TABLE OF
CONTENTS ]"></A> <A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A> <A HREF="./lg_mail21.html"><IMG SRC="../gx/back2.gif" ALT=" Back "></A>
<A HREF="./lg_bytes21.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<h5>This page maintained by the Editor of <I>Linux Gazette</I>,
<A HREF="mailto: gazette@ssc.com">gazette@ssc.com</A><BR>
Copyright © 1997 Specialized Systems Consultants, Inc. </H5>
<P>
<!--startcut ==========================================================-->
</body>
</html>
|