Shell Scripting Resources && Conditional

Hiya folks.
I'm looking for a great shell scripting site. Or a book. The Apple Mac Dev Centre is ... well she ain't workin for me.
For instance, I'm looking for some leadership on a conditional, which those docs won't show me:
troubleshooting=false
*if [$troubleshooting==1]; then*
* echo $troubleshooting*
* echo $nameStart*
* echo $myDate*
* echo $newFName*
* echo $mSource*
* echo $mTarget*
fi
How do I trip this conditional?
Cheers

How do you set a boolean?
Everything in a shell variable is a string. Some of those strings may look like numbers, but as far as the variable is concerned they are strings. There are no boolean variables. It is all in how you interpret the strings in your variable.
I'll have to check up on the syntax for bash.
You could read, reread, read and read "man bash". But I know it is not easy to actually figure out how to use the stuff the man page tells you, or even what they really mean when they use various terms. A book with examples helps, but there is magic hidden in the man page that sometimes takes ages and heavy use of shell scripting to figure out, and I've found that no one book will clearly explain every trick that can be done with shell scripts.
I prefer to have spaces in there, but not around parens of any kind. I wish languages would be the same that way. Heh.
And I like to have spaces around equal signs in assignments, but Bourne based shell scripts have their own rules. That is just the way it is.
The syntax for the 'if' command is
if list; then list; [ elif list; then list; ] ... [ else list; ] fi
where "A list is a sequence of one or more pipelines separated by one of the operators ...". "A pipeline is a sequence of one or more commands separated by the character |".
In the original Bourne shell (which ran in 64kilobytes of memory for code, data, and stack space) all expressions were handed by an external program 'test'. So your 'if' statement would have originally been
if test $troubleshooting = 1; then
fi
Someone figured out that Unix filenames do not care what characters make up their name, so a hardlink was created between /bin/test and /bin/[
ls -li /bin/test /bin/[
57880389 -r-xr-xr-x 2 root wheel 46720 Jun 17 2009 /bin/[
57880389 -r-xr-xr-x 2 root wheel 46720 Jun 17 2009 /bin/test
You will notice that 57880389 (the file's inode) is identical for both 'test' and '['.
So when you wrote
if [$troubleshooting==1]; then
the shell first processed the line and performed variable substitution, so the 'if' line converts to
if [false==1]; then
now the shell processes the 'list' of pipelines/commands following the 'if' statement. So a command is the first white space separate token, which is "[false==1]", so the shell looked in all the PATH directories looking for a file with the name "[false==1]" and did not find anything.
However, if you white space separate the command in the 'list' from its arguments, then the shell can figure out what the first command is, invoke that command, and pass its arguments to the command.
Now shells have more than 64kilobytes of memory to work with, and so the [[ ... ]] syntax was invented as a way to indicate that the expression was to use the shell built-in evaluation code. And I think bash eventually decided that it would do the /bin/[ program code evaluation as a built-in as well.
But since you can also say
if myprogram --opt --opt arg arg arg; then
fi
the shell must still be able to tell the difference between [ or [[ as expression evaluation operators, and a legal file with the name /home/me/bin/[myprogram, or $HOME/bin/[[myprogram, so it cannot assume that [ or [[ always start an expression evaluation.

Similar Messages

  • Configuring Shell Script Resource

    I am trying to configure a Shell Script Resource on my IDM Instance (8.1)
    So far, I only wish to "Test the Configuration", just to make sure that the IDM is able to CONNECT successfully to the Unix Machine, before I proceed to configure the Resource Handlers and Scripts.
    Whenever I press the "*Test Configuration*" button, I keep getting this error :
    Test connection failed for resource(s):
    java.lang.IllegalStateException: Error attempting to decrypt: Input length not multiple of 8 bytes
    I have searched everywhere online (even Google), but can't find a solution, or even a REASON for this problem (((

    reenter the password on Resource Parameters page and save it. Test the connection. If error still there post the stack trace from app server log here.

  • Configuring Shell Script Resource on IDM

    Hi all,
    I am in the process of configuring a Shell Script Resource on my IDM system.
    I used the Shell-Script-Resource-Object.xml (which is provided by IDM in the Samples folder).
    So far, everything worked fine. I set up the parameters, tested the "Test Configuration" button, and it was successful.
    The next phase is to proceed with the basic tasks (such as : create user, update user, delete user, etc)
    This is where my problem lies.
    The IDM manuals do not say anything about how this should be done. Neither do any of Sun's reference material (perhaps, I'm looking in the wrong place??)
    I know that the "Resource Actions" should contain the scripts themselves. But, there's no mention of how those scripts should be configured.
    The scripts themselves reside on the UNIX machine, which is where they should be. But, how should I invoke them?
    Any help will be much appreciated.
    Thanks

    OK.
    I created an entirely new script, which allows me to CAPTURE the data (parameters) from IDM, and use them to create a new user.
    It worked (or, it seemed to work).
    In IDM, i got the following error :
    *Error detected: [Adding account to hosts and creating quotas]
Default shell for netpasswd is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default shell for sui-dev is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default home path for sui-dev is /home. This can be changed later.Default shell for ssl3 is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default shell for sui-test is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default home path for sui-test is /home. This can be changed later.[Adding user to groups]
[Creating home directory]
DUMMY - ssh -2 -l root sui-dev "/usr/alt/uadm2/libexec/mkhome sui-dev /users1/u1/mjerome 44444 500 550 mjerome"
DUMMY - ssh -2 -l root sui-test "/usr/alt/uadm2/libexec/mkhome sui-test /users1/u1/mjerome 44444 500 550 mjerome"
[all done].*
    Result Code = 120.
    Error
    *com.waveset.util.WavesetException: An error occurred adding user 'mjerome' to resource 'Unix Administration'. com.waveset.util.WavesetException: Error detected: . com.waveset.util.WavesetException: Error detected: [Adding account to hosts and creating quotas]
Default shell for netpasswd is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default shell for sui-dev is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default home path for sui-dev is /home. This can be changed later.Default shell for ssl3 is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default shell for sui-test is /usr/alt/uadm2/bin/nologin. This can be changed later.
Default home path for sui-test is /home. This can be changed later.[Adding user to groups]
[Creating home directory]
DUMMY - ssh -2 -l root sui-dev "/usr/alt/uadm2/libexec/mkhome sui-dev /users1/u1/mjerome 44444 500 550 mjerome"
DUMMY - ssh -2 -l root sui-test "/usr/alt/uadm2/libexec/mkhome sui-test /users1/u1/mjerome 44444 500 550 mjerome"
[all done]. com.waveset.util.WavesetException: Result Code = 120.*
    From what is written there, I could see that the user was INDEED created. (Just to be sure, I checked my Unix machine. And, yes, the user was created)
    However, I keep getting the above error in IDM.
    I can't figure out any explanation besides the fact that, perhaps, this is because I do not have a RESULT HANDLER script in place yet.
    Could this be it?

  • How to engage Shell Script resource action in an Active Sync workflow.

    A little background, at my organization I have IDM set up simply to recognize changes in LDAP and transmit those changes, via active sync, to AD. We don't yet use the IDM interface to make any changes to users, instead we use external interfaces that we have written to make changes to LDAP which then get picked up via Active Sync and synchronized to AD. However, in addition to AD, there are several other resources that we would like to gradually wrap into this active sync workflow via native and custom resource adapters. Currently I am working on a simple Shell Script resource to manage Linux home directories. I have written all the necessary code and created the resource itself within IDM. This all seems to work, I can create, delete, disable, etc.. users in our Linux environment from the IDM interface.
    Here is the problem, I would like to integrate the creation, deletion, enabling, disabling, etc.. of users into the same Active Sync workflow that engages whenever a change is made to LDAP. This way, whenever a user is created in LDAP (and consequently AD), that user will be granted a home directory in Linux. Unfortunately it seems that Shell Script Resources are not enabled for Active Sync. Any ideas on how one might accomplish this?
    Thanks in advance.

    Thank you for the prompt reply. Funny thing is that I have been banging my head on this problem for a couple weeks now (this is my first attempt at real customization ... ). I finally got desperate and decided to reach out for help. After I posted this message I came to a realization that ended up solving the problem for me, go figure.
    For anyone in my place I can relate what I ended up doing, simple as it was. Keep in mind, of course, that this is a highly customized environment that I am working in so the specifics probably wont apply. What I basically did, is I found an LDAPCreateUserProcess form that gets invoked when Active Sync is run. For all I could tell, this simply processed the new attributes that came through Active Sync and related them to their llighthouse / AD counterarts. But I noticed a line like this:
    <Field name="waveset.resources">
    <Expansion>
    <filterdup>
    <appendAll>
    <ref>waveset.resources</ref>
    <s>AD</s>
    </appendAll>
    </filterdup>
    </Expansion>
    </Field>
    and simply added the name of my shell script resource under the <s>AD</s> line. That was it.
    Anyway, thanks bobm53, I can now get on with my life :-)

  • Shell Script Resource-Timeout error

    Hi!!
    I have an issue with the Shell Script Resource, the problem is as follows:
    When I created a user in this resource and appears a error message:
    com.waveset.util.WavesetException: An error occurred adding user 'user01' to resource 'Shell Script'. com.waveset.util.WavesetException: Script failed waiting for "_,)#+(:" in response "" com.waveset.util.WavesetException: Script processor timed out with nothing to read and the following unprocessed text: "".
    I added the timeout property = 300 000 in my shell script is as follows:
    <ResTypeAction restype='Shell Script' timeout='300000'>
    but it doesn't work.
    I had the IDM 8 with the patch 4 but the problem beging when I did upgrade to patch 4 to 6.
    Does anyone knows what could be the problem.
    Thanks in advance!

    Hello!
    That isn't the problem the test connection works fine but when I try provisioning a user the shell script execute some instructions, in the shell script I need to set the timeout property in order to give more time to finish execute the instructions before the script execute the following command.
    I tested the timeout property in the shell script and work to fine for IDM 8 patch 4 I upgrade to patch 10 and stopped to work.
    Does anyone knows What could be the rigth way to set the timeout property in a resource action for shell script resource?
    Thanks...

  • Shell Script Resource Adapter

    I am using version 7.0 and I'm trying to setup a resource using the Shell Script resource type. I am having issues with a few things:
    1. How do I let the system know there was an error in the shell script? No matter what exit code I use in the Actions I have configured for the resource, the system thinks everything was successful. Relatedly, how can I send back an error message - where can I view it?
    2. How do I send back multiple values for an attribute? When 'GetUser' is called, it is parsed by 'GetUser AttrParse', I haven't been able to successfully send back mutiple values for an attribute. I have tried semicolon separating the attributes so that I can comma separate the multi-values for an attribute. I have also tried pipe.
    3. When I setup a new resource with the shell script resource type, the 'Test Configuration' button calls a unix command that checks for a bunch of unix commands that have nothing to do with what I will be doing in my shell script. Is there a way to change the test?

    I found a way to send back multiple values for an attribute. Instead of using the collectCsvHeader and collectCsvLines AttrParse tokens as the resource reference guide says, I use str and skip tokens to parse the line. These tokens take delimiters and terminators for the line which allows me to send back multiple values for an attribute.
    Line being parsed looks like this:
    TEST USER, ,MN,People; /home/simtestusr; /bin/sh; 8888888888; simtestusr; 888; group1, group2; host1, host2, host2; ;
    <AttrParse name='UnixShellScript GetUser AttrParse' >
    <str name='gecos' trim='true' term=';'/>
    <skip len='1'/>
    <str name='homedir' trim='true' term=';'/>
    <skip len='1'/>
    <str name='shell' trim='true' term=';'/>
    <skip len='1'/>
    <str name='accountId' trim='true' term=';'/>
    <skip len='1'/>
    <str name='uid' trim='true' term=';'/>
    <skip len='1'/>
    <str name='uidnumber' trim='true' term=';'/>
    <skip len='1'/>
    <str name='groups' multi='true' delim=',' trim='true' term=';'/>
    <skip len='1'/>
    <str name='hostnames' multi='true' delim=',' trim='true' term=';'/>
    <skipToEol/>
    <MemberObjectGroups>
    <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
    </MemberObjectGroups>
    </AttrParse>
    Also, SUN is telling me that the exit code problem (#1) may be fixed in sp2 for 7.0, I'm waiting to find out when it will be released.
    I still don't have an answer for #3.

  • Shell script adapter and passwords

    Does anyone know how to get a password into a shell script resource adapter?
    I've set up the "password" attribute in my resource adapter's schema, expecting at least to see the encrypted password in in $WSUSER_password, but it's always empty. Other attributes I add to the resource scheme show up in the scripts as shell variables just fine.
    Side question - the Solaris resource adapter, which looks a lot like the shell script adapter, doesn't even have a password in its schema map, yet it seems to set passwords just fine. What's up with that?
    The ShellScriptResourceObjects55.xml example doesn't seem to deal with passwords at all.

    Hi,
    Have you been able to resolve this issue?
    I am currently working on configuring a Shell Script Resource on my IDM system.
    I am still in the "*Create User"* stage of things (I haven't even begun working with the other Actions : Get User, Get All Users, Delete User, Update User)
    After a month-long period of trial-and-error, and a lot of headaches, I finally succeeded in Creating a new user on my Unix Machine, without any errors
    Except for one thing : for some reason, the user I create is not being given a password!
    A first, I configured the "Attribute Mapping" page to include a "Password" attribute. This did not work.
    Then I removed the password from there (I figured that when I input the user's basic information on the IDENTITY tab in IDM, then the password gets automatically passed to the Unix machine).
    Still, this did not work.
    The funniest thing is : I am not getting any errors. The user is created on my Unix machine. And, also, in my My-SQL database.
    The problem is : when I try to log into that same Unix machine as the user, it does not work, because......of course.....*.there is NO PASSWORD*.
    What could be the problem?

  • Running a shell script in a Cocoa-Applescript, from the Resources folder?

    Hello!
    I need to use a bash script, but the script must be IN the application. I placed them in the "Supporting files", but i am not able to find them using "do shell script"
    Thanks!

    If you stick the script in the Resources folder you can get it by
    path to resource "Bash Script"
    If you want to put it in the folder Supporting files you need to construct the path
    (path to me as string) & "Contents:Resources:Supporting files:Bash Script"
    (where Bash Script is the name of your script)
    Don;t know if there is a shorter way for the second case.

  • Unable to check Null condition in a Shell Script

    Hi,
    When I am using to check the Null Condition To check for a Running Java Process its failing to check.
    I am using variable in a shell script
    DPID=$(ps -ef |grep - i java|grep -v grep)
    if [ "$DPID"="" ' ];then
    else
    fi
    If the DPID has Null value then its getting executed but if the DPID has value its not getting into the else part of the loop
    Thanks and Regards

    You could try -c to make grep return a count of matches, then check if this count is zero or not.
    DPID=`ps -ef |grep - i java|grep -vc grep`
    if [[ $DBID -ne 0 ]]; then
    else
    fi

  • How to execute power shell script file inside DSC script resource

    Hi,
    How to execute /call powershell scirpt file inside DSC script resource , some thing like below and capture the status of execution.
    Node $AllNodes.NodeName
    Script ExecuteSQLDeploy
    #SetScript = {powershell.exe .\SQLDeploy.ps1  "param1" "param2" "param3" "param4" "param5" }
    #TestScript= {powershell.exe .\SQLDeploy.ps1  "param1" "param2" "param3" "param4" "param5 }
    #GetScript= { return $true;}
    Basawaraj

    Thanks for reply. 
     Now i am able to execute the power shell script with DSC. I  am getting no error when i run , but the script logic wrote inside  ( deploying sql incremental changes ) not working . I am using SQLCMD in the powershell script to deploy sql
    changes . Can you please elaborate on "script is compatible with DSC" , the script
    should not contain write-host cmdlet.... etc something like that.
    Copying recursively from ****************************** to ************************** succeeded.
    Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
    An LCM method call arrived from computer ************ with user sid **********************************************
    [V-BAKANT]: LCM:  [ Start  Set      ]
    [V-BAKANT]: LCM:  [ Start  Resource ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ Start  Test     ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Test     ]  [[Script]ExecuteSQLDeploy]  in 0.1110 seconds.
    [V-BAKANT]: LCM:  [ Start  Set      ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Set      ]  [[Script]ExecuteSQLDeploy]  in 0.3010 seconds.
    [V-BAKANT]: LCM:  [ End    Resource ]  [[Script]ExecuteSQLDeploy]
    [V-BAKANT]: LCM:  [ End    Set      ]
    [V-BAKANT]: LCM:  [ End    Set      ]    in  0.8810 seconds.
    Operation 'Invoke CimMethod' complete.
    Time taken for configuration job to complete is 0.923 seconds
    Basawaraj

  • Executing if condition in a sql prompt with in a shell script

    Hi all,
    i need to write a shell script where i need to execute a sql statement. if the count from the above sql is greater than certain value i need to execute a another sql statement.After some time i need to check the count again using above sql and if the count is less than certain value i need to execute a different sql statement. One more time i need to check the count and then i need to get an email.
    Could anyone help me in completing this script
    Thanks,

    Could anyone help me in completing this scriptNot really because "shell script" is OS & Shell dependent & you decided to NOT share these details with us.
    Just write a PL/SQL procedure & then you have an OS independent solution!

  • Resource utilization alerts shell scripts, Memory and CPU

    Hi All,
    I am using the Oracle Enterprise Linux verison 4.6 x64 for Oracle 10g database. I want to implement some alerts for SWAP space thresholds, CPU comsumption and memory usage thresholds. For example I want an email alert is SWAP space is used 90%. Memory usage is more than 85%. CPU is 80% busy.
    I am sure that you Gurus must have implemented this kind of alerts through some tools or shell scripts so seeking your help to implement these.
    Thanks
    Naveed

    Hi Naveed,
    Firstly, I can tell you that Oracle has its own SNMP MIBs which can be used by SNMP to send trap (alerts) to various SNMP monitoring systems. If however, you are a bit like myself and perhaps don't have the cash or the need to use something so fancy, you can use Shell Scripting or in my case something like PERL.
    By using commands such as 'grep', 'awk' and 'less' (to name but a few) on can monitor simple things such as diskspace or memory.
    For example, if I were to look for diskspace usage on a partition known as u01 I could pipe in the output of 'df -h' to PERL, then run a regular expression on it looking for anything greater than 80%.
    Example of PERL code;
    # read in df -h command, looking for the partition /u01
    open(DISKUSAGE, "df -h | grep u01|");
    $diskUse = <DISKUSAGE>; #read its input
    chomp $diskUse; #remove last characterThis reads in the command into a 'buffer' in which you can search for things, i.e. to see if the disk usage is equal to, or greater than 80% from the variable $diskUse. As a starter I would look at splitting the string on empty spaces into an array for example, and reading the array index containing your disk usage. This can also be done with a Shell Script.
    Perl also has a very easy to use SMTP module which can be used for sending E-Mails. Do a search for Net::SMTP on google on how to use it. It really is very simple.
    I'm not expert on this stuff, and I'm sure there are many other and better ways of doing such things, but I hope this at least points you in the right direction.
    Best of luck,
    Conor

  • Shell script friendly paths in applescript

    I have a python script that resides inside a standalone application bundle. I run this script from the app and call it by getting the path of the application bundle and adding '/Contents/Resources/' to the path. This script sets or gets information from a plist. So, adding a ' --list' to the script name returns the items of the plist.
    This is my applescript and RWplist is the python script.
    set plInfo to do shell script "/Users/[just me]/Desktop/Test Project/Test App.app/Contents/Resources/RWplist --list'
    This fails due the the spaces in the directory and app name. If I change the folder and app name like;
    set plInfo to do shell script "/Users/[just me]/Desktop/Test-Project/Test-App.app/Contents/Resources/RWplist --list'
    This works... I tried wrapping the path in single quotes, I tried to do a replace all spaces to '\\space' in the path... and adding the 'quoted form of POSIX path of'...
    I'm guessing I'm placing the single quotes or using the quoted form... improperly. Can someone please explain how to format a path in this manor. I can't seem to find the proper syntax for this.

    This fails due the the spaces in the directory and app name
    Right, this is a common problem that many people encounter.
    I'm guessing I'm placing the single quotes or using the quoted form... improperly. Can someone please explain how to format a path in this manor.
    quoted form is the preferred/recommended way of doing this. Here's an example:
    set cmdPath to "/Users/just me/Desktop/Test Project/Test App.app/Contents/Resources/RWplist"
    do shell script (quoted form of cmdPath) & " --list"
    If you want to build the script manually then you should single-quote the entire path, e.g.:
    do shell script " '/Users/just me/Desktop/Test Project/Test App.app/Contents/Resources/RWplist' --list"
    Note that there are single quotes around the command path but the --list parameter is outside of the single-quoted path.

  • Using a UNIX shell script to run a Java program (packaged in a JAR)

    Hi,
    I have an application (very small) that connects to our database. It needs to run in our UNIX environment so I've been working on a shell script to set the class path and call the JAR file. I'm not making a lot of progress on my own. I've attached the KSH (korn shell script) file code.
    Thanks in advance to anyone who knows how to set the class path and / or call the JAR file.
    loggedinuser="$(whoami)"
    CFG_DIR="`dirname $0`"
    EXIT_STATUS=${SUCCESS}
    export PATH=/opt/java1.3/bin:$PATH
    OLDDIR="`pwd`"
    cd $PLCS_ROOT_DIR
    java -classpath $
    EXIT_STATUS=$?
    cd $OLDDIR
    echo $EXIT_STATUS
    exit $EXIT_STATUS

    Hi,
    I have an application (very small) that connects to
    our database. It needs to run in our UNIX environment
    so I've been working on a shell script to set the
    class path and call the JAR file.
    #!/bin/sh
    exec /your/path/to/java -cp your:class:paths:here -MoreJvmOptionsHere your.package.and.YourClass "$@"Store this is a file of any name, e.g. yuckiduck, and then change the persmissions to executechmod a+x yuckiduckThe exec makes sure the shell used to run the script does not hang around until that java program finishes. While this is only a minor thing, it is nevertheless infinite waste, because it does use some resources but the return on that investment is 0.
    CFG_DIR="`dirname $0`"You would like to fetch the directory of the installation out of $0. This breaks as soon as someone makes a (soft) link in some other directory to this script and calls it by its soft linked name. Your best bet if you don't know a lot of script programming is to hardcode CFG_DIR.
    OLDDIR="`pwd`"
    cd $PLCS_ROOT_DIRVery bad technique in UNIX. UNIX supports the notion of a "current directory". If your user calls this program in a certain directory, you should assume that (s)he does this on purpose. Making your application dependent on a start in a certain directory ignores the very helpful concept of 'current directory' and is therefore a bug.
    cd $OLDDIRThis has no effect at all because it only affects the next two lines of code and nothing else. These two lines, however, don't depend on the current directory. In particular this (as the cd above) does not change the current directory for the interactive shell your user is working in.
    echo $EXIT_STATUS
    exit $EXIT_STATUSEchoing the exit status is an interesting idea, but if you don't do this for a very specific purpose, I recommend not to do this for the simple reason that no other UNIX program does it.
    Harald.

  • How do I create a package that will install a shell script?

    From various sources I have made this shell script which creates a hidden admin user, starts ard and sshd.
    I would like to make this a package which will run on a machine on first boot. (I'm using deploystudio to deploy ML)
    It creates a hidden user called testuser1 with the password of password1
    [code]# Create user record in directory services
    dscl . -create /Users/testuser1
    dscl . -create /Users/testuser1 RealName "testuser1"
    dscl . -create /Users/testuser1 UniqueID 401
    dscl . -create /Users/testuser1 PrimaryGroupID 20
    dscl . -create /Users/testuser1 UserShell /bin/bash
    dscl . -passwd /Users/testuser1 "password1"
    # Set up a hidden home folder
    dscl . -create /Users/testuser1 NFSHomeDirectory /var/testuser1
    cp -R /System/Library/User\ Template/English.lproj /var/testuser1
    chown -R testuser1:staff /var/testuser1
    # Grant admin & ARD rights
    dseditgroup -o edit -t user -a testuser1 admin
    /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/ki ckstart -activate -configure -access -on -users testuser1 -privs -all -restart -agent
    # Tell loginwindow not to show the user
    defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool TRUE
    # Alternate: defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array testuser1
    # start remote login ssh
    systemsetup -setremotelogin on[/code]
    I'm using package maker but it keeps failing. If I add it from somewhere like my Documents dir it says it will give my username the permissions instead of root. If I add it from / and make root the owner packagemaker errors probably because my user doesn't have the rights to it. I want it to copy somewhere then maybe have another script that copies to the same location and does an rm to remove the previous script so no admin details are left on the machine

    Basicilly I want to roll out an image that will work with all models of macs which are comaptible with Mountain Lion. To do so I'm using deploystudio with the installESD.dmg as the image. This way it will install the relevant drivers for each model of mac. So the image should work whether it's a mac pro tower/mac mini/macbook.
    Upon completetion deploystudio lets you run packages so I would like the script above to be in a package. I don't want it even to copy the script anywhere I would just like it to run the .sh file I've made if thats possible?
    I'm just not sure what steps to take with packagemaker, I've never used it before.
    But yeah the ultimate goal is: upon installation completetion setup hidden admin user that will have ssh and ard access.

Maybe you are looking for