Difference between revisions of "Wrap-exec"

From Noah.org
Jump to navigationJump to search
Line 4: Line 4:
 
#!/bin/sh
 
#!/bin/sh
 
</pre>
 
</pre>
 +
 +
== Migrate Users From Old Linux box to new Linux box =
 +
 +
<pre>
 +
#!/bin/sh
 +
 +
#
 +
# This script helps migrate user accounts to a new server.
 +
#
 +
 +
IDMIN=1000
 +
IDMAX=29999
 +
DESTDIR=/root/migrate
 +
 +
if [ $(id -u) -ne 0 ]; then
 +
    echo "You must be root to run this."
 +
fi
 +
 +
mkdir -p ${DESTDIR}
 +
 +
awk -v VIDMIN=IDMIN -v VIDMAX=IDMAX -F: '(3VIDMIN) (3VIDMAX)'
 +
cp /etc/gshadow ${DESTDIR}/gshadow.old
 +
cp /etc/sudoers ${DESTDIR}/sudoers.old
 +
 +
tar czf ${DESTDIR}/etc.tar.gz ${DESTDIR}/*.old
 +
#tar czpf ${DESTDIR}/home.tar.gz /home
 +
echo "WARNING! Not including /home in the migration."
 +
 +
# vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline'
 +
</pre>
 +
 +
[[Category:Engineering]]

Revision as of 04:24, 4 November 2009


#!/bin/sh

= Migrate Users From Old Linux box to new Linux box

#!/bin/sh

#
# This script helps migrate user accounts to a new server.
#

IDMIN=1000
IDMAX=29999
DESTDIR=/root/migrate

if [ $(id -u) -ne 0 ]; then 
    echo "You must be root to run this."
fi

mkdir -p ${DESTDIR}

awk -v VIDMIN=IDMIN -v VIDMAX=IDMAX -F: '(3VIDMIN) (3VIDMAX)' 
cp /etc/gshadow ${DESTDIR}/gshadow.old
cp /etc/sudoers ${DESTDIR}/sudoers.old

tar czf ${DESTDIR}/etc.tar.gz ${DESTDIR}/*.old
#tar czpf ${DESTDIR}/home.tar.gz /home
echo "WARNING! Not including /home in the migration."

# vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline'