Self Service Script Question

tomt
Valued Contributor

I created a simple script to force a machine to update itself from our internal time server. It runs in seconds locally on my machine and when pushed out via ARD. I then created a policy around it and added it to Self Service. The policy does not do anything else (no recon, etc.).

When I activate it in Self Service it never finishes and the Self Service process just runs forever. Does anyone have any ideas on why it never completes when triggered from SS?

Here's the script:

---------------------
#!/bin/bash
# Force a clock update from listed time server.
ntpdate -u 172.21.1.9
exit
---------------------

Thanks,
Tom

4 REPLIES 4

paulaust
New Contributor

Why not just update the /etc/ntb.conf file to have the internal time server and an external server so that the machines always stay up to date. Here is a little script to do it.

#!/bin/bash

# List servers here
NTPServer1=time.wachovia.net
NTPServer2=time.apple.com

# Sets the first server
/usr/sbin/systemsetup -setnetworktimeserver $NTPServer1

# Adds second server to ntp config file
echo "server $NTPServer2" >> /etc/ntp.conf

# change system pref to have mac update on its own
/usr/sbin/systemsetup -setusingnetworktime on

Good Luck

tomt
Valued Contributor

Thanks for that Paul. I'm going to use it to resolve a different issue.

Our systems are already set to use an internal time server. That server has been having issues so I wanted to make a Self-Service script that would force an update from a different server.

rderewianko
Valued Contributor II

Have you tried running it in terminal as verbose?

sudo jamf policy trigger -id <policy id> -verbose
(the policy id can be found by going to the jss and hovering over any policy "show status" the url for that will have an id) should give you more input on why its not working from self service.

tomt
Valued Contributor

Excellent idea, don't know why I didn't think of that. Will try it later today.

Thanks