Sponsored Content
Full Discussion: UNIX System Admin Document
Top Forums UNIX for Advanced & Expert Users UNIX System Admin Document Post 33313 by hugo_perez on Friday 27th of December 2002 11:43:06 AM
Old 12-27-2002
In HP-UX ....

for users and groups:
Code:
#!/bin/ksh
echo "Relevando usuarios"
OS="`uname -s`"
server="`uname -n`"

if [ ! -d ./datos ]
then
    mkdir ./datos
    cod_ret=$?
    if [ $cod_ret -ne 0 ]
    then
        echo "ERROR: al crear el directorio ./datos"
    fi
fi

if [ ! -d ./datos/usuarios ]
then
    mkdir ./datos/usuarios
    cod_ret=$?
    if [ $cod_ret -ne 0 ]
    then
        echo "ERROR: al crear el directorio ./datos/usuarios"
    fi
fi

if [ -f ./datos/usuarios/"$server"_etc_passwd.txt ]
then
   rm -f ./datos/usuarios/"$server"_etc_passwd.txt
fi

if [ -f  ./datos/usuarios/"$server"_etc_groups.txt ]
then
   rm -f  ./datos/usuarios/"$server"_etc_groups.txt
fi

if [ -f  ./datos/usuarios/"$server"_crontabs.tar ]
then
   rm -f ./datos/usuarios/"$server"_crontabs.tar
fi

if [ -f ./datos/usuarios/"$server"_files_punto.tar ]
then
   rm -f  ./datos/usuarios/"$server"_files_punto.tar
fi

if [ -f ./datos/usuarios/"$server"_etc_profile.txt ]
then
   rm -f  ./datos/usuarios/"$server"_etc_profile.txt
fi

if [ -f ./datos_usuarios_$server.tar ]
then
   rm -f datos_usuarios_$server.tar
fi

case "$OS" in
  "HP-UX")
     echo "Relevando Archivo /etc/passwd en `uname -a`" | tee -a ./datos/usuarios/"$server"_etc_passwd.txt
     cat /etc/passwd | tee -a ./datos/usuarios/"$server"_etc_passwd.txt

     echo "Relevando Archivo /etc/group en `uname -a`"  | tee -a ./datos/usuarios/"$server"_etc_groups.txt
     cat /etc/group | tee -a ./datos/usuarios/"$server"_etc_groups.txt

     echo "Relevando files en /var/spool/cron en `uname -a`"
     tar cvf ./datos/usuarios/"$server"_crontabs.tar /var/spool/cron

     echo "Relevando Files .[a-z] de los Home Directories de Usuarios en `uname -a`"
     awk 'BEGIN{FS=":"}{print $1" "$6}' /etc/passwd | while read usu dir
     do
        echo "Relevando el HD: $dir del Usuario: $usu"
        if [ -d "$dir" ]
        then
           echo "Relevando el HD: $dir del Usuario: $usu"
           tar cvf ./datos/usuarios/files_punto_"$usu".tar $dir/.[a-z]*
        fi
     done
     echo "Relevando /etc/profile"
     cat /etc/profile |tee -a ./datos/usuarios/"$server"_etc_profile.txt
     ;;

  *) echo "Debe agregar al script la forma de relevar el OS $OS"

esac

tar cvf datos_usuarios_$server.tar ./datos/usuarios

added code tags for readability --oombera

Last edited by oombera; 02-20-2004 at 04:16 PM..
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Scripted Document Management System

Over the past 4 -5 years, I have cobbled together a rudimentary 'Document Management System' for a school district I support using Linux Bash Shell scripts.. The purpose of the scripting was to supplement features of a Job Applicant Center that had very simplistic methods of handle file... (1 Reply)
Discussion started by: rmuledeer
1 Replies

2. HP-UX

After becoming HP UX 11iV3 System Admin

What is a logical step forward to learn much more about HP UX? Learn HP Integrity BladeSystem Administration or learn more about scripting? Learn more about storage? Can someone tell me how to become more effective? I am already working with HP UX everyday. Thanks a lot for every reply I... (4 Replies)
Discussion started by: velde_van_der_a
4 Replies

3. Homework & Coursework Questions

System Admin. Lab

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a group id with your last name. Create 2 user IDs using your last name and the numbers 1 and 2. For each... (3 Replies)
Discussion started by: Jagst3r21
3 Replies

4. Red Hat

System Admin related document with example

Hi, I am looking for perfect document.which is covered all the admin role with examples..... --> Please say that "search in google"...... Can you please help on this.... Thanks & Regards, Mani (3 Replies)
Discussion started by: Mani_apr08
3 Replies

5. What is on Your Mind?

Regarding Admin life either as DBA or UNIX Linux admin

I am planning to choose my career as Unix/Linux Admin or a DBA. But I have come to know from forums and few admins like the job will be 24/7. I have few questions on that. Can we get "DAY" shifts in any one of the admin Job ? Can't we have shift timings in any company ? Eventhough the... (7 Replies)
Discussion started by: Jacktts
7 Replies
asadmin-delete-profiler(1AS)					   User Commands				      asadmin-delete-profiler(1AS)

NAME
asadmin-delete-profiler, delete-profiler - deletes the profiler element SYNOPSIS
delete-profiler --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename] [--terse=false] [--echo=false] [--interactive=true] Deletes the profiler element. A server instance is tied to a particular profiler by the profiler element in the Java configuration. Chang- ing a profiler requires you to restart the server. This command is supported in remote mode only. OPTIONS
--user authorized domain application server administrative username. --password password to administer the domain application server. --host machine name where the domain application server is running. --port port number of the domain application server listening for administration requests. --secure if true, uses SSL/TLS to communicate with the domain application server. --passwordfile file containing the domain application server password. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --interactive if set to true (default), only the required password options are prompted. Example 1: Using delete-profiler asadmin> delete-profiler --user admin --passwordfile passwords.txt --host localhost --port 4848 Deleted Profiler Where: profiler is the deleted profile element. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-profiler(1AS), asadmin-list-profiler(1AS) J2EE 1.4 SDK March 2004 asadmin-delete-profiler(1AS)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy