Swiftdialog

Asifahmed
New Contributor III

I was planning to send a message to end user through Swiftdialog via a JAMF policy but it has to be after a specified time like after 50 mins or 80 mins. Any way is there? I cant see any such flag in Swiftdialog, if anyone knows about it please let me know. 

18 REPLIES 18

sdagley
Esteemed Contributor II

@Asifahmed There isn't a delay option in swiftDialog, and you really wouldn't want to run a script payload for a Jamf Pro policy with a 50-80 minute sleep command because that would run much longer than the typical checkin interval of 15-20 minutes. What you could do is deploy a LaunchDaemon and a script to be triggered by that launchDaemon which calls swiftDialog to display your notification and remove the LaunchDaemon.

Asifahmed
New Contributor III

My requirement is like, it will run a script and based on its result it will throw a message to end user after 50 mins or 80 mins, its a single script. Not two. All logic has to be within swfitdialog, so curious to know if such feature is available in swiftdialog or not.  Like as shutdown -r +50 is an example for understanding. So after 50 mins mac will restart if I run this command, same I need in swiftdialog so that after 50 mins it will throw a message to end user. Hope it make sense. :)

mm2270
Legendary Contributor III

There isn't such a delay feature in swiftDialog. It's a messaging tool with tons of features, but such a delay goes beyond the functionality of the tool itself. You will need to spin off a process or script separately from a policy that waits the specified amount of time and then displays the dialog.

Asifahmed
New Contributor III

Is it possible in Jamfhelper?

sdagley
Esteemed Contributor II

No, as with swiftDialog JamfHelper is simply a message display tool. You're going to have to create a script to drive one or the other and apply the logic you want for the user notifications an actions to take based on those actions. Since that script is going to take much longer than the usual checkin interval you'd probably want to run it from a LaunchDaemon, but if you don't care a Mac running your script isn't going to be checking in while it's running then...

PhillyPhoto
Valued Contributor

@sdagley wrote:

JamfHelper is simply a message display tool.


You can use the -timeout flag with JamfHelper (https://hcsonline.com/images/How_to_use_Jamf_Helper.pdf)

mm2270
Legendary Contributor III

If you could elaborate on what your end goal is here, we could probably help with putting something together. It sounds like you want to 1) send up a dialog, 2) user responds, possibly choosing between a few options, 3) depending on their choice, you send up another dialog again in 50 or 80 minutes. Is that right?

If so, to do something like this involves creating a separate process that will send up the second dialog at the time you specify, or after x minutes have passed. I don't think you want to have this all done in a single script, because you would have to have a long sleep set in the script, and I can tell you having a policy run a script that goes into a long sleep period is not a great idea. A few minutes is fine, but an hour or more, and it may end up consuming resources on the endpoint and could get stuck and cause you further issues.

 

Asifahmed
New Contributor III

I have a policy to restart mac if it has uptime more than 3 days, by help of  jamfhelper, message is getting thrown to end user's screen to restart the mac with 5 options, now, after 1 min, 5 mins, 1 Hr and 2 Hrs. If user select 1 Hr or 2 Hrs then we want to throw another message to end user just 5 mins back before restart operation to close/save all opened items. I am not able to throw such message before 5 mins back of the restart operation as at command is also disabled by default in macOS. So any idea? :) I dont want to make any more big complexity like LaunchA or daemon creation.

sdagley
Esteemed Contributor II

As a long time Mac developer prior to putting on a Mac IT hat I was fond of saying any program that will ever be written has already been written, you just had to find all of the pieces and put them together. In other words a longer way of saying "Don't re-invent the wheel."

Take a look at https://github.com/SecondSonConsulting/Renew and the associated Wiki https://github.com/SecondSonConsulting/Renew/wiki to see if it'll handle pushing your users to restart (I think 3 days is a little short, and would use something like 4 weeks personally, but to each their own). I haven't tried it personally, but it's in my Notes list of potentially useful things to investigate.

Asifahmed
New Contributor III

I started working on it to do a test on my test mac, I copied the Renew.sh file in /usr/local and copied the launchAgent in ~/Library/Preferences/ and installed SwiftDialog on my mac, I built a config profile with a JSON file attached in it and putted the restart message and deployed on my mac, but I cant see any popup is coming for restart. If you have then please let me know if I missed anything here. I think this will be a better solution than what I thought before.

Asifahmed
New Contributor III

I just got the .pkg for Renew.sh file and LaunchAgent, I ran there, lets see how does it go. Please ignore my previous message.

Asifahmed
New Contributor III

Ohk, great! It is throwing the popup now, I will do the branding now. Thanks. 

mm2270
Legendary Contributor III

 

"copied the launchAgent in ~/Library/Preferences/"

Was this part a typo? Because LaunchAgents do not go there. It would go into /Library/LaunchAgents/ or ~/Library/LaunchAgents/. The latter directory might need to get created since it won't be there by default.

Asifahmed
New Contributor III

My mistake, I did it now, it thrown the popup now. I need to do the branding of my company's logo and other message, test is successful I can say. I will let you know how does it go. Thanks

Asifahmed
New Contributor III

I noticed one thing. I configured notification message, normal mode message and aggressive mode message, interesting thing is that I am getting only popup only for aggressive mode not getting notification or message in normal mode. Any idea?

Asifahmed
New Contributor III

I got the point why it moved to aggressive mode directly.  I deadline field I wrote 0 so it moved to aggressive mode instead of notification and normal mode. But to get the notification still I need to manually enable the notification turned on for Dialog from System Settings or else it is not going notify user.  Any idea how to enable Dialog notification turned on through JAMF?


@sdagley wrote:

As a long time Mac developer prior to putting on a Mac IT hat I was fond of saying any program that will ever be written has already been written, you just had to find all of the pieces and put them together. In other words a longer way of saying "Don't re-invent the wheel."

Take a look at https://github.com/SecondSonConsulting/Renew and the associated Wiki https://github.com/SecondSonConsulting/Renew/wiki/coreball to see if it'll handle pushing your users to restart (I think 3 days is a little short, and would use something like 4 weeks personally, but to each their own). I haven't tried it personally, but it's in my Notes list of potentially useful things to investigate.


Thank you.

 

greenapple
New Contributor

I cannot get Jamf helper, or Renew to pop-up any dialog.   Frustrating.  Which config file can i use to get Renew to opo-up anything!