Home › Forums › OS X Server and Client Discussion › Misc. › loginhook problem
Hi all,
I have a script that I’m trying to run as a loginhook. The script does what it is suppose to do if I run it manually after I login, but it will not run as a loginhook. Can anyone see from the script below what the problem might be?
[code]
PRIVATE=`cat /Library/Scripts/Custom/private` DEPTDATA=`cat /Library/Scripts/Custom/data` if [ “`/sbin/ifconfig en0 | /usr/bin/grep ‘inet xxx\.xx\.’`” ] then mkdir /Volumes/$USER mkdir /Volumes/DeptData `/sbin/mount -o nodev,nosuid -t smbfs ‘//’$PRIVATE” ‘//Volumes/’$USER”` `/sbin/mount -o nodev,nosuid -t smbfs ‘//’$DEPTDATA” ‘//Volumes/’DeptData”` echo $USER echo $DEPTDATA else echo “you aren’t connected” fi [/code]
Thank you in advanced
$USER is not defined when the loginhook runs.
loginhooks are passed the shortname of the user as the first argument, so using “$1” instead of “$USER” should fix that.
Also, if you really posted the entire script, you need to add a “she-bang” line to the beginning, ala:
#!/bin/sh
-Greg
Comments are closed