Login Scripts question

I have cobbled together a script which display a users quota information when logging in. The script works fine and I can get it to run from the login script managed preference set in workgroup manager. The problem I have is that the script is reporting the user as root rather than the login user. My understanding is that login scripts (not loginhooks) run as the login user rather than the root account or is this incorrect? Trust level is set to anonymous at the moment.
Here is the script so its more clear what im doing:
#!/bin/sh
# quotas - displays usage levels on server.
# get user's short name.
thisUser=`whoami`
# get quota from LDAP
maxSpace=`ldapsearch -h myserver.com -b "dc=myserver,dc=com" -x -LLL uid=$thisUser apple-user-homequota|grep apple|awk {'print $2'}`
# convert to MB
maxMegs=`expr $maxSpace / 1024 / 1024`
maxGigs=`expr $maxSpace / 1024 / 1024 / 1024`
# Returns user's home directory disk usage in 1024 KB blocks.
currentSpace=`du -sk ~ | awk '{print $1}'`
# convert to MB
currentMegs=`expr $currentSpace / 1024`
# floating point math for percentage used
spaceUsed=`echo "scale=2; $currentMegs / $maxMegs" | bc`
percentUsed=`echo "scale=0; $spaceUsed * 100" | bc | sed -e "s/.00//g"`
/usr/bin/osascript <<-EOF
tell application "System Events"
activate
display dialog "Disk Usage for user: $thisUser used: $currentMegs Mb max: $maxGigs Gb percent: $percentUsed %"
end tell
EOF
exit

In the future, please post your Code Snippits between
... your code here ...
That will preserve all your formatting and prevent the forum formatting code from stealing some of your characters.
And it will make it easy for people to see what you really wrote as your script.
PS. Why not just use the quota command?
Message was edited by: BobHarris

Similar Messages

  • POST request in a login script

    I have a strange problem when the variables that are passed to a PHP script dont get recognized in an equal statement. The java code :
    tring value, value2;
         try {
         BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
         URL url = new URL("................./admin.php");
         URLConnection connection = url.openConnection();
         connection.setDoOutput(true);
         System.out.println("Enter your username");
         value = stdin.readLine();
         value = URLEncoder.encode(value, "UTF-8");
         System.out.println("Enter your password");
         value2 = stdin.readLine();
         value2 = URLEncoder.encode(value2, "UTF-8");
         System.out.println("Acessing the ECHO server script");
         PrintWriter out = new PrintWriter(connection.getOutputStream());
         out.println("username="+ value);
         out.println("&password="+value2);
         out.close();
         BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
         String inputLine;
         System.out.println("Retrieving data");
         System.out.println("");
         while ((inputLine = in.readLine()) != null)
             System.out.println(inputLine);
         System.out.println("");
         in.close();
         catch (Exception e)
         System.out.println("Error: "+e);
         System.out.println("Processing Acomplished");In case somebody wonders, this is part of the php script
    if (isset($_POST['username']) && isset($_POST['password']))
    $username = $_POST['username'];
    $password = $_POST['password'];
    echo $username;
    echo $password;
    if ( $username == "1" && $password == "2" )
    echo "CORRECT";
    else
    echo "INCORRECT";
    }Now, the script successfuly recieved my data, and prints it back. However, whenever i try to check if the value is "1", for example, it always evaluates to FALSE. I am completely lost, because the script print back 1, and then says that 1 != 1
    I know it looks like script problem, but im almost sure that its not.
    Maybe the data that java post's is encoded differently or something, and the script cant really "interpret" it. Did anyone else encounter any problems with login scripts and java ?
    Sorry if this is a lame question, i'm just beginning....

    I know it looks like script problem, but im almost sure that its not.I'm almost sure it is. Check that it's not comparing the string "1" to the integer 1 or something. But the way you present it the problem is almost certainly in the PHP rather than the Java.

  • Login Script for HP Thin Clients using Citrix

    Hi
    Could someone please assist me with this.
    I use a login script on my domain but I am now joining the HP Thin Clients onto the domain which will use SSON (Single Sign ON) which will automatically load citrix and use the current username and password to sign into the citrix session
    Is there a command I can use that will "check" the version of windows and if this is Windows 7 embedded Standard edition, then it will bypass all the commands and go to the end of the script.
    I was trying something like this IF "%OS Version%" == "Microsoft Windows 7 Embedded Standard" goto END
    I know you can use this for a "Computer Name" but we have so many terminals and would need to store all the names of them on the servers.
    Please can someone give me some advise on this.
    Thanks
    Martin

    Hi,
    As far as I know, you can user command systeminfo | findstr /B /C:"OS Name" /C:"OS Version"to check current system edition in
    Command Prompt. However, as I'm not fimilar with script, to need more assistance for your problem, it would be better to provide your question at script center.
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
    Roger Lu
    TechNet Community Support

  • MEMBER OF command in login script

    Hello,
    Just wondering if any one else has had trouble getting the MEMBER OF command to work in their login script? I have tried using group names as well as the full context but I can't get it to work and perform the desired actions.
    Thanks.

    On Wed, 12 Jun 2013 14:26:02 +0000, captainjd02006 wrote:
    > Just wondering if any one else has had trouble getting the MEMBER OF
    > command to work in their login script?
    It's worked for me here for 15+ years. Maybe you're doing it wrong? Show
    us a sample of what you're trying to do.
    David Gersic dgersic_@_niu.edu
    Knowledge Partner http://forums.netiq.com
    Please post questions in the forums. No support provided via email.

  • Using Login Scripts with OD

    Has anyone had success using login scripts from OD? When I try to add a script to the login prefs, i get an error that the script is not executable.
    Alternately, could anyone suggest an effective way to mount volumes based on user group membership? I've tried adding scripts, automator created apps and workflows to the login items without success.
    thanks.

    Hi
    Good question. I don’t really know. What I can say is I once attended a site where two of Apple Euro’s technical consultants implemented both methods. Neither mentioned either as being ‘best practice’. Both methods worked by the way. My gut feeling is the method not involving a login script would probably be what Apple would steer you towards. Although in my opinion whatever method works for you that gives you what you want would be ‘best practice’.
    Try cross posting this in the Terminal Forum. There are some guys there who are pretty handy when it comes to AppleScript.
    Hope this helps – Tony

  • Launching NAL from login script AND startup?

    We are about to upgrade from Zen 3.2 to 7. Part of the process involves ensuring the clients launch NAL with a /NOUPDATE switch. (The NOUPDATE switch must be used to ensure that Zen 7 agents are not accidentally back-rev'ed during the upgrade process.) We currently have deployed the script-based method to launch the 3.2 NAL, but still have many desktops that either launch with a batch file or through the Startup group. (Too many to visit on a timely basis)
    I want to know if subsequent launches of NAL.exe WITHOUT the /NOUPDATE switch override the settings of the original one launched in the script. If launching NAL from Startup without switches doesn't override the one in the login script, I won't need to worry about hitting each of these machines before we begin deploying the Zen 7 Agent.
    Does anyone know if NAL refuses to launch again if it already is detected in memory?

    Off the top of my head, I dont know the answers to your question, but
    when I went through this process I just moved and renamed all the NAL
    related files from the PUBLIC dirs so the ZEN7 Agent could not become
    back dated.
    The existing 3.2 agents kept running from the local PC like always and
    after the PC was upgraded to ZFD7 there were no files in PUBLIC from
    which the PC could accidentally get old files.
    Ron Granberg wrote:
    > We are about to upgrade from Zen 3.2 to 7. Part of the process involves
    > ensuring the clients launch NAL with a /NOUPDATE switch. (The
    > NOUPDATE switch must be used to ensure that Zen 7 agents are not
    > accidentally back-rev'ed during the upgrade process.) We currently have
    > deployed the script-based method to launch the 3.2 NAL, but still have
    > many desktops that either launch with a batch file or through the
    > Startup group. (Too many to visit on a timely basis)
    >
    > I want to know if subsequent launches of NAL.exe WITHOUT the /NOUPDATE
    > switch override the settings of the original one launched in the
    > script. If launching NAL from Startup without switches doesn't override
    > the one in the login script, I won't need to worry about hitting each of
    > these machines before we begin deploying the Zen 7 Agent.
    >
    > Does anyone know if NAL refuses to launch again if it already is
    > detected in memory?
    Craig Wilson
    Novell Product Support Forum Sysop
    Master CNE, MCSE 2003, CCN

  • Windows 7 & bat files & login script

    We have Netware 6.5 SP8.
    How can I run a bat file from the login script so that it will "Run as Administrator" on the Windows 7 workstations?
    Thanks...

    Actually this is more of a MS/Win7 batch processing question.
    In short, you can't assign Admin rights to batch files, only to EXE or
    shortcuts.
    Therefor, try creating a shortcut to the batch file.
    Right-click on the shortcut -> Properties -> Shortcut tab -> Advanced.
    Click "Run as administrator".
    Test locally.
    Now you can try passing that shortcut to the Login Script command
    handler - something like:
    #cmd /c start [shortcut]
    or
    #%<comspec> /c start [shortcut]
    Note, this is all untested and unsupported.
    Good luck
    Wolfgang
    On 28.06.2012 20:46, ncharleyhog wrote:
    >
    > We have Netware 6.5 SP8.
    >
    > How can I run a bat file from the login script so that it will "Run as
    > Administrator" on the Windows 7 workstations?
    >
    > Thanks...
    >
    >

  • Unique Script Questions-timed startup?

    Hello All,
    I am long time mac fanatic with some unusual script questions. I have a project ongoing where I will need to put my pb 15" in a remote location with a Canon camera. Canon has transmitter device which will allow me via ethernet to ftp to my pb.
    Here's essentially what I need to the script to do and I am trying to find out just how feasible this is. I need my laptop to bootup to receive photos via ftp at a certain time period. The camera will send to the builtin ftp software. Once booted I need the script to hold for period of about an hour. Once time has elapsed I need the script to connect to the internet via a broadband EVDO card. We are using one of the EVDO cards built in to Tiger. It then must ftp a folder of images to a remote server.
    Simple, huh? : ) I am running Transmit as my ftp software. I believe it is scriptable and will watch a folder to send.
    Any ideas? I'd love to hear them. I can be reached via scott at scottaudette.com.
    This setup is going be used in very cool photo location but I can't publicly announce where.
    Scott
    G5 and PB 15"   Mac OS X (10.4.7)  

    'Transmit ... I believe it is scriptable' - yes it is. Go to How can I use AppleScript with Transmit? to download sample 'Transmit' scripts.
    'Once booted I need the script to hold for period of about an hour.' - well then, save the script as a 'stay open' application, with an 'on idle () ... end idle' handler - with a return of (60 * 60) seconds; and then drag the saved application onto the 'System Preferences' 'Accounts' 'Login Items' tab's list - of the user which the Mac will boot to (when turned ON).
      Mac OS X (10.4.4)  

  • Login script location

    Simple question today... I want to add a line to my login script, but when I did a "ls -la ~/" I didn't see anything that looked like a login script. Some history files, a couple app-specific ones (.Xcode, .matlab), and a couple odd but empty ones. Does one exist by default? If not, what name should I give the file I create? Thanks!

    It depends, actually. I have the following login files: .profile (sh, bash if no .bash_profile), .bash_profile (bash), .login (tcsh, csh).
    - cfr

  • How do I connect my Centro to the Internet via bluetooth over PC's Internet? Where is Centro's PPP Connection Type? How do I setup Login Script for bluetooth connection?

    I am trying to set up bluetooth on the Centro to connect to the internet via my PC's internet.
    HotSync over bluetooth works successfully.
    Computer specs: Toshiba P205-S6277; Bluetooth Stack v5.10.04 (currently using); Bluetooth Monitor v3.01 (to use Vista's built-in bluetooth)
    I think I have narrowed my problem down to 3 things.
    (1) Finding Network Access properties (to allow connected devices to access the internet)
    (2) Finding Centro's Network Connection Type: PPP
    (3) Finding the correct Login Script to use
    for (1) I think I've looked everywhere; found nothing on Network Access. 
    Checked control panel: only Bluetooth Local COM
    Right-clicked bluetooth icon > Settings: File transfer, PAN Networking, PAN DHCP server, AV controls. Other bluetooth settings are for file transfer or object push. I don't see anything like this.
    I'm stumped on (2). It seems as if palm removed this option under Centro's Advanced network settings .
    Nearly all the forums that I read says to choose Connection Type: PPP.
    (3) Found 2 scripts that seemed would work. I don't know how it exactly works but it sounds workable.
    First script:
    Send: CLIENT
    Send: CLIENT
    Wait for: CLIENTSERVER
    End:
    Script 1 Connect Log:
    =======================================
    Connect Log
    S: client
    S: client
    R:
    Err: 0x121F   <<<netErrUserCancel b/c I canceled it. 
    Not connected
    ========================================
    I canceled it because the process would stay on "Signing In" then it automatically "Canceled" itself.
    Second script:
    Send CR:
    Delay: 1
    Send: CLIENT
    Wait For: CLIENTSERVER
    End
    **UPDATE** I found on this forum (Reply # 3689) that the script is needed only if you are using Palm OS 4 or under. Centro uses Palm OS 5.49121. Can anyone support this?
    Even without the script it has problems "Signing In".
    I'm currently reading this site and trying out its decribed methods. I will update this thread when I get the results.
    I'm using the Centro. And If anyone's been able to successfully connect to the internet on the Centro via a bluetooth connection to the PC WITHOUT 3rd party applications, please share.  If not, please share any ideas.
    Thanks!
    -Eric
    Post relates to: Centro (AT&T)
    Message Edited by naisanza on 01-01-2009 02:26 PM

    I've been going at this for days, and have probably exhausted all the proposed solutions on the first 3 pages of various google searches. I'm getting the feeling that Vista users are pretty much SOL for the time being.
    For the record, I just tried out a few of the solutions (mRouter & SoftickPPP) on XP and they work perfectly.
    Post relates to: Centro (Verizon)
    Message Edited by Cogwheel on 02-13-2009 09:45 AM

  • How to change the Default login script and the USER login script in Netware3.12

    I need to cut down the disk map from Neware 3.12 in Win98 client's PC.
    please tell me
    how to change the Default login script and the USER login script in
    Netware3.12 ?
    Or is there any other ways to do this thing?
    Thanks a lot!

    On 4/6/2006 [email protected] wrote:
    > how to change the Default login script and the USER login script in
    > Netware3.12 ?
    Please repost in the discontinued.forums.
    Edison Ortiz
    Novell Product Support Forum SysOp
    (No Email Support, Thanks !)

  • Is it possible to run an application from a user or container login script?

    Is it possible to run an application from a user login script or a container login script?
    A "Force Run" application object works fine if the user's workstation is setup to auto-load "Application Window" or "Application Explorer" but in this case I'd like to run an application when someone does a manual login (ie. they right-click red "N" and choose "Novell Login...")
    Using a User Package's "Scheduled Action Policy" and the Event=Login also does not work when a user logs in manually. This type of Event seems to only apply when the user first logs into the workstation, not at a manual login.
    Thanks,
    Marc

    > Is it possible to run an application from a user login script or a
    container login script?
    Yes, see the documentation:
    http://www.novell.com/documentation/...a/a7q6999.html
    Regards
    Rolf Lidvall
    Swedish Radio (Ltd)

  • Login scripts not running with AnyConnect NAM and ISE 1.2

    I am using AnyConnect 3.1 NAM as my 802.1x supplicant for ISE 1.2.  When users log in with EAP Chaining (User and Machine Auth), the login script seems hit or miss on if it runs to map their drives.  If I uninstall the NAM client, they map drives every time.  I would think that running a login script to map drives is a common scenario and I was wondering if anyone else using AnyConnect NAM was having similar issues or how they were dealing with it.

    I have the same issue and I solve the issue with change these parameters.
    1.- You must change on configuration profile "before user logon". I have 5 seconds
    2.- You must change on configuration profile  "port authentication Exception policy" and you must enable checkbox "enable port exceptions" and select "allow data traffic before authentication"
    3.- You must enable in the option of interface Ethernet Intel on PC "Wait for link" this option It's in "configured advanced of Intel. You must select "on" in this option.
    4.- (this recommendation it was by Cisco) 
    Active Direct GPO has a setting "Computer Configuration\Administrative
    Templates\System\Logon\ Always wait for the network at computer startup and logon" that
    can be enabled to make the logon scripts wait till 802.1x authentication is completed.
    With those changes the logon script run fine.
    Regards
    David.

  • Launch application according to script/question result

    Hello
    I would like to install an application via ZENworks, but I need to ask the user if he wants to install it or not?
    Can I ask this to the user in a script and then launch another application (or the same) only if the user selected 'Yes' for example? or is possible to do it another way?
    Thanks

    Adelpicc,
    > I don't "need" it. But for the application object, with the pre-launch
    > script, there's a field for the scripting engine and one for the
    > extension. So I don't know what to put execpt cmd or wscript. Is there a
    > scripting engine to use your code (and specially the command "TERM")?
    >
    See the docs:
    "Script Engine Location The script engine determines the script commands
    and scripting language you need to use. If you do not define a script
    engine in the Script Engine Location field, Application Launcher uses the
    Novell ClientTM as the script engine (if the workstation has the Novell
    Client installed), which means that you can use most Novell Client login
    script commands."
    Ie, leave it blank and it will use the Client login script processor.
    - Anders Gustafsson (Sysop)
    The Aaland Islands (N60 E20)
    Novell has a new enhancement request system,
    or what is now known as the requirement portal.
    If customers would like to give input in the upcoming
    releases of Novell products then they should go to
    http://www.novell.com/rms

  • Creating a new OU and the login scripts don't work

    Goodday,
    We are running DSfW for almost a year and we never had to make a new OU but that time has come.
    When I make a new OU (with iManager or AD tools) the outcome is the same: The login scripts I make for the new OU will not execute within iManager.
    If I make a new (test)user of move an existing user (with or without a GW account) the login script is not executed.
    If I place a login script directly on the user it works.
    I've patched everything and is up-to-date.
    What is different on exisiting OU's and new OU's is that it's missing two attributes:
    ACL 2#entry#ou=...#loginScript
    ACL 2#entry#ou=...#printJobConfiguration
    Maybe this has nothing to do with it but the first one I was thinking maybe this is the problem.

    Originally Posted by preemeyer
    Goodday,
    We are running DSfW for almost a year and we never had to make a new OU but that time has come.
    When I make a new OU (with iManager or AD tools) the outcome is the same: The login scripts I make for the new OU will not execute within iManager.
    Can you please give the details of how you are specifying the login script. Is it using a GPO?
    Originally Posted by preemeyer
    If I make a new (test)user of move an existing user (with or without a GW account) the login script is not executed.
    If I place a login script directly on the user it works.
    Is it by specifying the script path in existing profile tab?
    Originally Posted by preemeyer
    I've patched everything and is up-to-date.
    What is different on exisiting OU's and new OU's is that it's missing two attributes:
    ACL 2#entry#ou=...#loginScript
    ACL 2#entry#ou=...#printJobConfiguration
    Maybe this has nothing to do with it but the first one I was thinking maybe this is the problem.
    Can you check if the container is samified, and samify it if it is not.
    domaincntrl --samify
    May not work, but can be tried.

Maybe you are looking for