You are not logged in.
Pages: 1
Hi all,
I'm using the last OCS_MAC_AGENT. Everything is fine exept the row "Computer" in OCS main list. With the last OCS_MAC_AGENT, I got the LOCALHOST NAME of my mac machines, but I need the "Computer Name" like we can see in system profiler or in System Preferences/sharing.
I'know there is something to change in ocs_mac_agent.php but I can't find exactly the function to change.
Could you please, help me ? :-)
Thanks,
Gaël
Offline
I've hacked together the following patch that will do this. It's very handy since I have users using DHCP and changing hostnames. It's based on the 4.3 release. It also changes the php script so that it only calls hostname or scutil on time, and uses the results in the rest of the script. I'd submit a patch properly, if I can figure out how.
--- ocs_mac_agent.installed.php 2007-11-06 12:27:30.000000000 -0500
+++ ocs_mac_agent.php 2007-11-06 13:09:06.000000000 -0500
@@ -73,0 +74,3 @@
+// Set hostname if desired, comment out only one of the next 2 lines - location of systemsetup will vary depending on OS
+define('OCSHOSTNAME', exec('scutil --get ComputerName'));
+//define('OCSHOSTNAME', exec('/bin/hostname -s'));
@@ -526 +529 @@
- $s_hostname = exec('/bin/hostname -s');
+ $s_hostname = OCSHOSTNAME;
@@ -609 +612 @@
- $this->message('Inventory for ' . exec('/bin/hostname -s') . ' is up to date');
+ $this->message('Inventory for ' . OSCSHOSTNAME . ' is up to date');
@@ -719 +722 @@
- $this->message('Starting inventory of ' . exec('/bin/hostname -s'));
+ $this->message('Starting inventory of ' . OCSHOSTNAME);
@@ -788 +791 @@
- $this->_data['CONTENT']['HARDWARE']['NAME'] = exec('/bin/hostname -s');
+ $this->_data['CONTENT']['HARDWARE']['NAME'] = OCSHOSTNAME;
Offline
Kalak,
This is exactly what I need. How do I apply this patch?
Thanks!
Offline
copy and paste the above to a file (starting with the "---"). Open a terminal window and type the following (with the name of your file used):
cd /usr/local/sbin/
sudo patch -p0 < /path/to/your/filename
enter your password when prompted and that's it
Offline
Plans to port this to 4.4? Or was it submitted to the developer?
Offline
It is not relevant for 4.4, as it uses "/usr/sbin/scutil --get ComputerName" where necessary to get the hostname, or you can set it from the command line by: ocs_mac_agent.php -n
Offline
We are running into this same problem on some of our MACs running version 4.4. The computer is reporting that it is using SCUtil to report the name but the name being reported is the DHCP name and not the name SCUtil has identified. We also find that many machines when trying to change the computer name do not reflect that change in the OCS database but keep the original name.
Has anyone tried using the latest Beta? If so, does it fix the problem being discussed in this thread?
Thank you.
Offline
Pages: 1