# # From a user addition bash script I worked on, these are the key functions # I wrote to help with adding Lawson users to the system. # # The drop directory for the rd30.csv file and the oracle tablespace # names can easily be modularized. # orauser () { # # This routine creates an intermediate text file in /tmp with # commands to add the new user to Oracle. It then grants # appropriate roles and permissions. # # Note: the create user statement overwrites the file if it exists # # JE 2002-07-12 # DESTFILE=/tmp/new_orauser.sql ORAUSER=oracle8 PWFILE=/etc/orasys.crypt echo "create user ${userid} identified externally;" > ${DESTFILE} echo "grant lawson_role to ${userid};" >> ${DESTFILE} echo "alter user ${userid} default tablespace ladata01;" >> ${DESTFILE} echo "alter user ${userid} temporary tablespace temp;" >> ${DESTFILE} echo "alter user ${userid} quota unlimited on ladata01;" >> ${DESTFILE} echo "alter user ${userid} quota unlimited on laindx01;" >> ${DESTFILE} echo "alter user ${userid} quota unlimited on temp;" >> ${DESTFILE} # # For my next trick, I will make SQLPlus exec this script # Of course, I put the password right in here, so you can see the # fishing line, but you need to be forgiving. It's been a long week. # # A note about this command. The password has been encrypted using # crypt. Not very secure, but it keeps plain text passwords out # of a shell script. Should the password for sys change, please # recreate this with the following steps: # - put the new sys password in a text file # - use the following command to create an encrypted version: # bash$crypt key < password.txt > password.crypt # - remove the file with the plain text password # # JE 2002-07-12 # su - ${ORAUSER} -c ". /etc/profile;export ORACLE_SID=PROD;sqlplus sys/`crypt key < ${PWFILE}` @${DESTFILE} << EOF" return; } rd30 () { # # This routine creates a CSV file suitable for loading into Lawson # using the MS-Addins # # JE 2002-07-12 # clear echo "This section will create an import file suitable for loading an RD30 record into the Logan product line with MS-Addins." echo -n "Is this user a member of (F)inance, or a (B)usiness Manager: " read GROUP GROUP=`echo ${GROUP} | /usr/bin/tr "[:upper:]" "[:lower:]"` while [ "${GROUP}" != "b" ] && [ "${GROUP}" != "f" ] do echo -n "INVALID Choice! Please Reenter: " read GROUP GROUP=`echo ${GROUP} | /usr/bin/tr "[:upper:]" "[:lower:]"` done if [ "${GROUP}" = "b" ] ; then { echo "${userid},${fname} ${lname},Staff,1,${fname},${lname},${userid},EM,PROD,Y,Y,${userid},,,,,,,,,,," >> /tmp/rd30.csv } fi if [ "${GROUP}" = "f" ] ; then { echo "${userid},${fname} ${lname},Finance,1,${fname},${lname},${userid},FN,PROD,Y,Y,${userid},,,,,,,,,,," >> /tmp/rd30.csv } fi clear echo "Don't forgot to use the MS-Addins to import /tmp/rd30.csv" return; }