13 Replies Latest reply on Mar 11, 2011 10:00 AM by Meat

    MAC Virgin

    zman Master

      He guys, you probably don't see me too much around her but I think that is going to change. I was given about 20 MACs to support in a our Windows environment. I've been banging my way through the process,  MAC OS X, LANDesk, etc... I've learned a lot but feel like a total idiot. I've been reviewing a lot of Posts by Snowman and Patrick. We are not using anything like Centrify or quest (still evaluating), and most of the customization has landed on the LANDesk plate. I'm pretty good with scripting on the Wintel side, but again Apple side is totally different. I got these links of the site:

       

      http://apress.com/book/view/9781430224433
      http://macscripter.net/

       

      Just wondering if anybody has any other articles (something like Jared has on the Windows side) concerning scripting, best practices for MACs and LANDesk, etc...

       

      Thanks.

        • 1. Re: MAC Virgin
          Apprentice

          I am also interested in material like this. I am our LANDesk admin and MAC admin and although we only have a few macs to support, it would be nice if I could utilize LDMS's mac support a little more.

          • 2. Re: MAC Virgin
            SupportEmployee

            Zman,

             

            Which article are you referring too when you say "something like Jared has on the Windows side"?

            • 3. Re: MAC Virgin
              zman Master

              Snowman,

               

              It only deals with one specific aspect of scripting (batch) which is good because it does a very good detailed job. http://community.landesk.com/support/docs/DOC-2320

              • 4. Re: MAC Virgin
                SupportEmployee

                That's a pretty good doc. I hadn't seen that before. I'm unaware of anything like that for mac scripting with a LANDesk focus. I could look into putting some information together but it wouldn't be right away. I'm currently working on an SLM doc for LD9 SP2.

                 

                Just so I understand. Which scripting language were you looking at doing? shell, perl, python, php, or ruby? And if shell which environment? bash, csh, tcsh, ksh, zsh, tclsh?

                 

                You can find a high level overview here if needed. http://developer.apple.com/internet/opensource/opensourcescripting.html

                 

                There are tons of pre-made scripts and information websites out there. I could look at referencing some of that information and possibly put some stuff together with a LANDesk focus and how it handles the scripts on mac. But there are so many options scripting wise that it would be hard for me to find time to cover them all.

                1 of 1 people found this helpful
                • 5. Re: MAC Virgin
                  zman Master

                  Thanks Snowman. Therein lies the issue:

                  Just so I understand. Which scripting language were you looking at  doing? shell, perl, python, php, or ruby? And if shell which  environment? bash, csh, tcsh, ksh, zsh, tclsh?

                   

                  So many options LOL. In Wintel I use Autoitscript and Batch.  I think maybe some recommendations for what would be the easiest to start with and then build upon.

                  • 6. Re: MAC Virgin
                    Employee

                    Hi Zman,

                     

                    I believe the simplest ones would be the Shell scripting ones, you can compare that to the batch scripting of Windows if you need something simple but able of more complicated tasks at a Powershell level. I believe the most commonly used is Bash.

                     

                    The remaining ones would be maybe comparable to a .vbs script, being python and ruby probably the easyest ones to start with.

                     

                    You can find thousands of tuturials around with a simple query on google.

                     

                    For bash:

                    http://tldp.org/LDP/abs/html/

                     

                    Python:

                    http://wiki.python.org/moin/BeginnersGuide

                    • 7. Re: MAC Virgin
                      Apprentice

                      The only thing specific to LANDesk as far as scripting is concerned is getting those scripts to add data to your inventory. I have a couple examples on my site here: http://blog.macadmincorner.com/category/landesk/

                       

                      Are there any specific tasks you need to accomplish on these 20 macs, or you just looking for something to do?

                      • 8. Re: MAC Virgin
                        Meat Rookie

                        You can get good support for the Mac and bash shell scripting at these locations:

                        http://www.macenterprise.org/mailing-list

                        http://tldp.org/LDP/abs/html/

                         

                        You can push single line commands easily with the LANDesk script feature

                        As a fun test, push this to a test machine:

                        REMEXEC01=say "I'm sorry Dave. I can't do that."

                         

                        As a note, many Mac configuration shell commands are Mac specific. Most are not, but...

                        I'm pretty sure the command "say" is Mac specific.

                         

                        You can push full fledged shell scripts as well, pushed as deployments.

                        Remember, man is your friend. Go to the terminal and type "man say" without the quotes, of course. The "q" key exits man.

                         

                        To see all the commands a particular machine has at it's local disposal, hit the tab key twice. Use man to examine commands that look interesting to you.

                         

                        A bash shell script (named sayscript) for the say command above would look something like:

                        #!/bin/bash

                        #

                        # This is a script that uses the say command.

                        # Created by me, just now, for you.

                        #

                         

                        say "I'm sorry Dave. I can't do that."

                         

                        if [ $? -ne 0 ]; then

                            logger -s Sayscript did not run successfully

                            exit 1

                        fi

                         

                        The first line of the bash script "#!/bin/bash" should always be the first line of a bash script. It tells the system which shell to use for the commands and their arguments in the script. You could in theory use #!/bin/sh since in OS X bash and sh are basically the same.

                         

                        Shell scripts, regardless of the shell you choose to use, should always start with #!/path/to/shell

                        Another example starting line:

                        #!/bin/ksh

                         

                        Each shell has slightly - to wildly different syntax requirements. Bash is the most widely used shell, and doesn't beg for additional modules to be installed on the target machine.

                        I have not had a requirement to venture outside of bash for my scripting, but that may just be me.

                         

                        This is waaaayyyy to deep to cover in a single forum post, but it should make for a decent starting point.

                        • 9. Re: MAC Virgin
                          Jared Barneck SupportEmployee

                          You are going to have similar issues with MAC running shell scripts as you do in Windows running batch files.

                           

                          You can create a shell script package and push it to a MAC.  However, I believe it runs as a system account not the logged in user.  You need to make sure you have the rights you need.

                           

                          Try these books.

                           

                          Classic Shell Scripting

                          MAC OS X UNIX Toolbox: 1000+ Commands for the Mac OS X

                           

                          It is a fun learning experience to push a script that does nothing but output the environent variables to a file.  Then you can look at the environment variables that exist when you push a shell script and compare them to the environment variables that exist when you open a shell as a user.  There are usually interesting differences.

                          • 10. Re: MAC Virgin
                            zman Master

                            Thanks guys, great info. Now I just have to find time to learn.

                            • 11. Re: MAC Virgin
                              Rookie

                              interesting for me,thanks

                              • 12. Re: MAC Virgin
                                Apprentice

                                I dont know if this will help you but I know a lot of the Mac techs I work with use this package building tool; http://www.jamfsoftware.com/products/composer

                                • 13. Re: MAC Virgin
                                  Meat Rookie

                                  There are a few packaging options, and certainly JAMF is a fine choice.

                                  My needs are relatively simple, so I use Iceberg.

                                  http://s.sudre.free.fr/Software/Iceberg.html

                                   

                                  I typically know where everything is that I want to package up, so it's a fine tool for me.

                                  Others use Apple's Package Manager (for me, it's a bit obtuse) and other folks use other tools.

                                   

                                  Try a few out, read a few reviews, and see what makes the most sense for you. You can always decide to switch to another packaging tool if you need to.