Archive for the ‘SysAdmin’ Category

SVN – Quick Startup

Friday, September 10th, 2010

SVN (or Subversion) Quick Startup

For version control – In 3 to 4 easy steps, place a given directory and all dirs and files under that directory, under SVN control.

Process Summary – Create a Repository, Import current files into that repository, Checkout files from repository to desired working directory, work on files, committing as you go to collect versioning information.

  1. Create a repository
    • i.e. svnadmin create –fs-type fsfs /path/to/svnrepo
  2. Import files into the repository
    • i.e. svn import /path/to/files/you/want/under/svn-control/ file:///path/to/svnrepo/ -m “Initial import”
    • NOTE; This will import all sub-dirs as well.
  3. Probably delete the original location of the files imported into the repo, backing up the originals first of course.
    • i.e. rm -rf /path/to/files/you/want/under/svn-control/
    • NOTE; Of course, this isn’t relevant if your going to place working copy somewhere other than original location.
  4. Create a working copy/location where you want the files to reside.
    • i.e svn checkout file:///path/to/svnrepo/ /path/to/final/working/location/
  5. Work on files in /path/to/final/working/location/.
    • i.e. cd /path/to/final/working/location/; vi <somefile>; svn diff; svn commit -m “First edits”
    • NOTE: All subdirs are under SVN as well. Commands like “svn commit” will propagate to subdirs as well.
  6. A specific example; putting my ~/bin/ directory under SVN control.
    • $ svnadmin create –fs-type fsfs ~/MyBinDirSVNRepo/ # create repo
    • $ svn import ~/bin/ file:///home/bryan/MyBinDirSVNRepo/ -m “Initial bindir Import” # import files into repo
    • $ tar -cvf ~/bin.tar ~/bin/ # backup original files
    • $ gzip ~/bin.tar
    • $ rm -rf ~/bin/ # remove original files
    • $ svn checkout file:///home/bryan/MyBinDirSVNRepo/ ~/bin/ # checkout files back into orig location
    • Now all files under ~/bin/ are under SVN control. # Edit and commit

Cheatsheet:

  • svn diff ; see what’s different before commiting.
  • svn diff -r 1:2 <somefile> ; show diff between ver 1 and ver 2 of <somefile>
  • svn diff -r 5 <somefile> ; show diff between current working copy and ver 5.
  • svn commit ; if you leave off the “-m” you’ll be prompted to enter a comment.
  • svn blame <somefile> ; see who edited each version (blame being mis-leading of course)
  • svn info ; repo info, like were the repo is located.
  • svn info <somefile> ; everything you wanted to know about a file in the repo, latest ver, etc, etc.
  • svn info <somefile> ; everything you wanted to know about a file in the repo, latest ver, etc, etc.
  • svn list ; everything in the repo
  • svn ls ; same as “svn list”
  • svn status -v ; provides latest version of each file. Useful in know were to start doing “svn diff -r #:# <somename>
  • svn add <newfile> ; adding a new file to the repo.
  • svn status ; show status of each file (if all matches repo, then no output)
  • svn update ; syncs with repo, includes pulling in diffs in repo into working copy. Only makes sense if you have multiple copies checked out.

References:

The Laptop Herring

Monday, September 3rd, 2007

A great article on meetings:

“What are the things you are supposed to do to make a successful
meeting?” First hand: “Make sure everyone closes their laptop.”

Powered by ScribeFire.

Using viewports with vim

Monday, March 26th, 2007

A great vim tip.

Powered by ScribeFire.

Nice HowTo on setting up ssh keys

Wednesday, January 3rd, 2007

Here’s a nice straight forward HowTo on setting up the use of ssh keys for use with ssh or sftp between servers.

Rsync for archiving

Friday, November 10th, 2006

What is “-a (–archive)” in rsync, and the alternative if one just wanted to just get any missing files copied to dest.

-a, –archive = -rlptgoD

-r, –recursive

-l, –links

When symlinks are encountered, recreate the symlink on the destination.

-p, –perms

This option causes the receiving rsync to set the destination permissions to be the same as the source permissions. (See also the –chmod option for a way to modify what rsync considers to be the source permissions.)

-t, –times

This tells rsync to transfer modification times along with the files and update them on the remote system. Note that if this option is not used, the optimization that excludes files that have not been modified cannot be effective; in other words, a missing -t or -a will cause the next transfer to behave as if it used -I, causing all files to be updated (though the rsync algorithm will make the update fairly efficient if the files haven’t actually changed, you’re much better off using -t).

-g, –group

This option causes rsync to set the group of the destination file to be the same as the source file. If the receiving program is not running as the super-user (or if –no-super was specified), only groups that the invoking user on the receiving side is a member of will be preserved. Without this option, the group is set to the default group of the invoking user on the receiving side

-o, –owner

This option causes rsync to set the owner of the destination file to be the same as the source file, but only if the receiving rsync is being run as the super-user (see also the –super option to force rsync to attempt super-user activities). Without this option, the owner is set to the invoking user on the receiving side.

-D The -D option is equivalent to –devices –specials.

–devices
This option causes rsync to transfer character and block device files to the remote system to recreate these devices. This option has no effect if the receiving rsync is not run as the super-user and –super is not specified.

–specials
This option causes rsync to transfer special files such as named sockets and fifos.

# -v, –verbose
# -z, –compress compress file data
# -P equivalent to –partial –progress
# –partial keep partially transferred files
# –progress show progress during transfer
# –size-only only use file size when determining if a file should be transferred
# -W, –whole-file copy whole files, no incremental checks
# –ignore-existing ignore files that already exist on the receiving side
# -n, –dry-run show what would have been transferred

To copy files, without worry about perms, times, groups, etc:

rsync -rlvz –size-only –whole-file –ignore-existing

i.e. rsync -rlvz –size-only –whole-file –ignore-existing –stats ~/Sites/ /Volumes/sites/

Domain name mismatches in SSL certificates

Thursday, November 2nd, 2006

Finally a solution to the warnings of mismatched domain-names when using SSL for IMAP and/or POP. If your like me, and query several different domain-names served by a hosting company, the domain-name of the actual machine queried for IMAP and/or POP (the reverse DNS lookup) will differ from that of your domain-name. The email client then thinks something is suspicious and barks at you for every account and you have to interact by telling it it’s “ok to continue.” If you have several accounts this can get annoying, as every time you open your email client you will be prompted once for every account. And if you use SMTP over SSL, you’ll get the same thing when trying to send. I finally found some fixes for this problem.

For Thunderbird (win or mac), see this posting.

For OS X Mail client: see the section “Avoiding SSL Certificate warning” in this posting.