Category Archives: Technology

Copy and Backup Utility Review – Robocopy or Xcopy, Which One?

Robocopy or Xcopy Which One to Use?

These two command line file copy utilities seem to provide the same functions. However don’t be deceived by the number of options xcopy provides. It is just a as it is a poor relative of the more robust, featured,
When to Use Xcopy and When to use Robocopy?
If you need advanced features such as backing-up, type of copy and you want 100% reliability of the copy process then Robocopy (robust copy) is your choice. If on the other hand, you don’t have a complex copy job Xcopy will do it. Xcopy is part of the operating system, it comes with Windows, whereas robocopy needs to be copied from another system, or you need to install the Resource Kit. To put it more simple, xcopy is always available as the shell command “copy”.

Features of Xcopy and Robocopy

Why not use the shell command copy then, is the next question. Because “copy” is just too minimal and cannot accomplish what the other two can. It only copies files and not directories with the afferent directory structure. It cannot copy attributes and ACLs.
In contrast, the other two file copy utilities are featured in such way that they can be easily used as backup systems if the correct options are setup. In conjunction with the scheduler and using a batch script this can be a powerful backup solution that is both inexpensive and flexible.
The features of Xcopy and Robocopy are: selective attributes replication, ACLs can be maintained or not for the files copied, ownership can be copied or not, folder structure replication, fully automation, archive attribute support – which makes it a real backup utility, file exclusion option, verification of the copied files, performance tuning.

What are the differences between Xcopy and Robocopy?

If we were to sum up we could say that Robocopy is way more powerful than Xcopy. But of course you might ask me for arguments to support my statement, here they are:
The most annoying thing about Xcopy is that you can’t use the network restartable mode if you copy ACls. Isn’t this annoying? For me this was enough of a reason to install the Resource Kit and get the Robocopy immediately. But wait, the list doesn’t stop here.

Robocopy as a Backup Software

Why is Robocopy worth writing about? Robocopy is a great software that can be used as a backup utility. Its features makes it fit for maintaining automated file backup using various approaches. It can be used for directory mirroring, for archiving files, for moving files, etc…
It can be used to copy only new or changed files, it can use the archive bit, as any good backup software would.
If the target directory is enabled for compression, it can save space as well.
Another application of Robocopy is during migrations or server upgrades. Because sometimes migrations or server changes are time sensitive, we need to copy as much as possible before switching to the new server. This where Robocopy comes in handy. You start the mirroring ahead of time, so all the files are copied. When the time of switching is close there are only minor changes to be done so the operation is very fast. The key options for this applications are: robocopy /MIR to mirror the directory, robocopy /MON:n to MONitor the source and run again when more than n changes occur and robocopy /MOT:m to MOnitor source and run again in m minutes Time, if changed.
Another neat application is to archive files that haven’t been used in a given period.
This command moves files that haven’t been used in 500 days, in restartable mode, copying the attributes, the file’s owner, and the ACL, excluding older files.
robocopy C:\FILES \\SERVER\FILES-ARCHIVE /e /zb /r:0 /w:1 /copy:daso /xo /move /MINLAD:500

Other Cheap Backup Utilities

Another cheap, (free), utility is xxcopy.
The utility competes with Robocopy, has versions for both 32 bit and 64 bit OS, and has more command switches.
However, this isn’t a free program for businesses, it is free for for personal use though.

Downloads and Resources

Download the resource kit for Windows 2003 here, (the resource kit contains robocopy): http://www.microsoft.com/download/en/details.aspx?id=17657
You can download xxcopy here: http://www.xxcopy.com/xcpydnld.htm
A robocopy GUI interface can be downloaded here: http://download.microsoft.com/download/f/d/0/fd05def7-68a1-4f71-8546-25c359cc0842/UtilitySpotlight2006_11.exe
Another robocopy GUI interface can be downloaded here: http://download.microsoft.com/download/f/d/0/fd05def7-68a1-4f71-8546-25c359cc0842/HoffmanUtilitySpotlight2009_04.exe

Centos Network Configuration – on a Barebones from Command Line

Centos LogoCentos Network Configuration – is very simple on a full installation. However, I downloaded the Centos’ “Minimal Install” cd and used yum to install various packages I needed.

The simple way to do it if you have a standard installation is to use the Network Administration
Tool (system-config-network), which is a graphical interface to edit the configuration files. Since I haven’t installed this tool, I needed to edit the files manually.

How to Configure Network in Centos from Command Line:

A quick way to see if your interface works and if you can ping internal resources.
ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Use your IP addresses.
Note that this is not persistent, at the first reboot, ot first network services restart this will be lost.

For a DHCP address assignment use:
ifdown eth0
dhclient eth0

To get a persistent centos network configuration use the following procedure:

Edit the network configuration file

vi /etc/sysconfig/network-scripts/ifcfg-eth0
Edit the configuration file so it contains your IP address configuration as follows:
DEVICE="eth0"
BOOTPROTO=none
HWADDR="00:00:00:00:00:00"
NM_CONTROLLED="yes"
ONBOOT="yes"
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
IPADDR=192.168.0.2
PEERDNS=no
USERCTL=no

This configures your interface with the IP 192.168.0.2 and the netmask 255.255.255.0.
For more info about Centos’ network configuration look here: .

Set up Name Resolution

Name resolution configuration, is more consistent across various Linux distributions. Most of the Linux distros will have the configuration file at /etc/resolv.conf.
Edit this file and change according to your network:
vi /etc/resolv.conf
Modify the file so it contains pointers to your DNS servers like this:
nameserver 192.168.0.254
nameserver 192.168.0.253

Scalix Administration – Useful Commands

Scalix LogoScalix is now a mature email server, reliable and powerful, that can accommodate environments with thousands of users.
Most of the tasks can be accomplished using the web interface, which is a nice and intuitive interface. However, not all the tasks needed for a day to day administration are available from the web interface.

Here are some command line Scalix administration commands for the daily use as an email administrator.

Check Scalix services from CLI

omstat –a
omstat –s

lsof –i:25
lsof –I:143
lsof -i :5733
ps -ef | grep postmaster

Users unable to VIEW the inbox content

Try the following steps.

Run:

 
omshowu -n username -f
This should give you the location of the user folder similar to this "~/user/g000038".
Go to /var/opt/scalix/ll/s/user/g000035 (in our case) and remove the "imap-cache" directory then restart the imap server (users will get logged off).
rm -r imap-cache

STOP and START IMAP
Restart IMAP service: omoff -d 0 -a IMAP & omon IMAP

Users unable to VIEW some of the inbox content

Ask the user to log off!!! AND to stay logged off until you finish!!!!
View which users are loged on: omstat -u all
View the process associated with that user: ps -ef | grep 55003 Where 55003 is the user id.
Kill the processes associated with that user: kill -9 “process id”
Fix the mailbox: omscan -Avfx -U “User Name”
Restart the scalix service: omshut -t3 && sleep 3 && omrc
(sxfixdref –f)

sxaa problems
Delete the user’s 3d files in the above folder (/var/opt/scalix/ll/s/user/g000035)

Issues with the web interface

Restart Tomcat and Apache2
/etc/init.d/scalix-tomcat stop
rcapache2 stop
rcapache2 start
/etc/init.d/scalix-tomcat start

CDA server not starting

omoff -d 0 -w cda 
omreset -o off cda

delete the lockfile, (if it exists):

rm /var/opt/scalix/ll/s/sys/omcda.lock  
 omon cda

SPAMASSASSIN problems

Location: /etc/mail/spamassassin
Important files:
Init.pre
Local.cf
V310.pre
V312.pre
Update-channels

Automated update via crontab

cat /etc/cron.daily/spamassassin-updates

(this will update the filesd and restart spamassassin)
Update rules are located at:
/etc/mail/spamassassin

Edit Spamassassin Whitelist and Blacklist

vi /etc/mail/spamasassin/whitelist.cf
Entries should be of the form: whitelist_from queen_213@hanmail.net

vi /etc/mail/spamassassin/vi whitelist.cf
Entries should be of form: blacklist_from user@domainname

when whitelist and/or blacklist are modified…

  1. check for error: spamassassin –lint
  2. restart spamd /etc/init.d/spamd stop and then /etc/init.d/spamd start

Check bounces email on Postfix
tail -f /var/log/mail | grep NOQUEUE

Troubleshoot sending or receiving

  1. Check the ldapmapper and make sure it’s working.
    /etc/init.d/ldapmapper status
    /etc/init.d/ldapmapper stop
    /etc/init.d/ldapmapper restart
  2. Check the sendmail daemon – make sure it’s working.
    ps aux |grep sendmail
    You should see two things: Accept connection and Queue control
    If you don’t see them, restart the service. Sometimes you need to create your own script for starting sendmail, instead of using the one that comes with the distribution.

Clean Scalix Queues

Service router queue, Internet Mail Gateway queue, Local Delivery queue.

CLEAN INTERNET MAIL GATEWAY QUEUE

 echo -e "A$(( $(date +%d) + 10 ))E\nl\nunix\n\n" |
  omqdump -p |
  ./clearq.pl |
  tee output

CLEAN LOCAL QUEUE
echo -e “A$(( $(date +%d) + 10 ))E\nl\nlocal\n\n” |
omqdump -p |
./clearq.pl |
tee output

CLEAN ROUTER QUEUE
echo -e “A$(( $(date +%d) + 10 ))E\nl\nrouter\n\n” |
omqdump -p |
./clearq.pl |
tee output

Always use a new file, output is a sample file name

Once done, de-activate scalix services , except omstmon, omsessd, queue.manager and RUN OMSCAN (this will synchronize the database)
omscan –Aqvfx
stop scalix normally, start scalix normally.

Maintenance in Scalix

Delete user

/opt/scalix/bin/omdelu -n CN=FirstName LastName/G=FirstName/S=LastName/OU1=lcbmail

Regular maintenance

omscan –Aaf (Select all areas for checking/scanning and fix)
omscan -Avuo3 -f (-A active – refreshes the omscan; -u each user; -o 0 output normal)
omscan -Avfx -U “User Name” (scans only one mailbox)
omscan -AavfxS

Refresh omscan to the latest results
omoff -d 0 scan (shutdown omscan)
omscan -Z (capital z) (reset omscan counters)
omon omscan (restart omscan)
omshowlog -f 10.05.07 -F 09:09:00 (-f date –F time) from “Date”, from “Time” (-t date –T Time) to “date” “time”
omscan -avfx – remove the orphans
omscan -AavfxS – active mode to check and fix any issues it can find – it doesn’t clear orphans
sxdu -hs (show actual mailbox space usage)

Clean up Users’ Mailboxes:

omtidyallu -Twr -a 100 –d -c -k (purges everyone’s trash and recovery directory) do not attempt unless you have to, (for example you are out of space on server) – this will delete all users’ email

omtidyu
-T folder[s] Defines which folders the following criteria is to be applied to:
i refers to the intray;
o refers to the outtray;
f refers to the filing cabinet;
w refers to the wastebasket (Deleted Items folder).
p refers to the pending tray; and (Sent Items – ?)
l refers to the List Area.
r refers to the Scalix Recovered Items folder.

Examples of Mainenance Cleaning in Scalix

omtidyu -B -u “user name” -k -T i -t “[SPAM]*” returns emails with the subject [SPAM] in the inbox
omtidyu -B -u “User Name” -d -k -T i -t “I Love You” removes all message with the subject.
omtidyu -B -u “User Name” -d -k -T i -a 365 deletes all the email older than 365 days
omtidyu -B -u “User Name” -d -T i -a 4 – moves the email messages in the Wastebasket
omtidyu -B -u “LCB Mailer” -d -k -T i deletes permanently all the messages in Inbox
omtidyu -B -u “User Name” -d -k -T iofwlrp -a 365

Import/Export mailboxes, backup, restore in Scalix

sxmboxexp –user “User Name” -a /mnt/temp/uname.mbox
sxmboximp -a /mnt/temp/uname.mbox –user ” Test User”

Scan mailbox for last login time

/root/sxlastlog.pl >lastlogin.txt
more /root/ lastlogin.txt
This could be tricky if you want to get the inactive mailboxes, since you won’t know the status of the redirected mailboxes.

Scan users’ mailbox for usage

Sxdu -sh

Show all mailboxes

omshowu –m all

Pull details of a specific mailbox

omshowu –m all | grep –i nameofindividual

View details of mailbox

omshow nameofindividual or authentication ID

Delete a duplicate account

omdelent -e local-unique-id=’ID’
omdelent -e g=given_name/s=surname

List, search users, mailboxes and email addresses

List number of users per country
omsearch -e S=* -m CNTRY >Email_list.txt
add additional attributes like name (/CN) or email address ( :
omsearch -e S=* -m CNTRY/CN/IA-FORMAL
omsearch -e S=* -m CNTRY/CN/IA-FORMAL
omsearch -e S=* -m CNTRY/CN/INTERNET-ADDR
omsearch -e S=* -m CNTRY/CN
or add all attributes:
omsearch -e S=* -m @all-attr@

per country list export to text file:
omsearch -s -e CNTRY=JP -m S/CN/IA-FORMAL >Japan_Users.txt

omshowatt for a list of attributes

omsearch -s -m CNTRY/G/I/S/CN/IA-FORMAL >list-of-users.txt

Search Accounts ibn Scalix

omsearch -e “G=<firstname>/S=<lastname>” -m @all-attr@

Search an Account If You Have the Email Address
omsearch -m @all-attr@ -e IA-FORMAL=email@cordonbleu.edu (you can use * )

Read and Edit the Mailbox Rules in Scalix

sxaa –user username (get the active and inactive rules)
sxaa –user username –remove 501 (remove the rule with the reference 501)
sxaa –user username –off 600 (disable, without removing the rule with the ref 600)
sxaa –user username –on 600 (enable the rule with the ref 600)

Other Useful Commands in Scalix

ps –ax ( list of processes)
Top –p pidID (stats about specific process)

More info on the error from omshowlog
omsolve -n OM 16094

Search for content ZIP compressed logs on the fly
bzcat /var/log/mail-20070610.bz2 | grep -i webmaster | less –S

Find the abbreviated names for a Scalix service
omshowlvl –a –l

 

Not Related To Scalix But Useful

tcpdump -ni eth0 port 5729 -s 0 –A
watch -n1 cat /dev/vcs10 (see the logs on the tty10 console)

rdiff-backup a great utility to backup your system

Scalix Migration

Move users to other mail-nodes.
Note that you don’t need to specify your node if the user is in the default node. –o is old –n is new.
ommodu -o username -n “Firstname Lastname”/Parisnode