Open Terminal and run Command via Self Service?

maiksanftenberg
Contributor II

Hi.
We are having some users that don't have admin rights but need to see what happening on the system.log file in Terminal.
They use tail -f /var/log/system.log

Is there a way to open Terminal Window and run this command in this window?

Thanks

8 REPLIES 8

Cem
Valued Contributor

create a script :
#!/bin/bash
tail -f /var/log/system.log

then save it with ".command" extension at the end of the file. This will allow users to double click to run it from Terminal.

Chris_Hafner
Valued Contributor II

Yep. You could even run that right from Self Service if you wanted to.

Cem
Valued Contributor

you can package the script as above (lets call it "log.command"). Then run it with the command line open log.command

This will open the Terminal with the result.

I haven test this but it should work

maiksanftenberg
Contributor II

Great guys.
Thanks.

Will try this and let you know.

Cheers,
Maik

Cem
Valued Contributor

You can combine all these in to one package. Command can be run as postflight script. Then make it available from Self Service.

jhalvorson
Valued Contributor

This has inspired me to add a few more lines to my post image script. Our config techs claim my jamfhelper notifications of the various stages are not detailed enough to know what's happening. I'll just bring up system.log , installer.log, and jamf.log for them. (Mostly I think they are concerned with not knowing what's happening when it's applying all available Apple software updates.)

Next they will want me to figure out how to set the terminal windows sizes so it displays the logs nicely.

maiksanftenberg
Contributor II

It seems not to work as expected in our environment.
As our users are not local admin they can not view the system.log file.
So we place the log.command on the HDD and allow the execution of it via a Policy.

It's opening the terminal but it seems it will be open as users as it directly stops with the Command "Permission denied"...

Even with a PKG with Postflight it's the same.

Any idea? :-(

Cem
Valued Contributor

try to change the system log file permission - this will give read only rights to any user. Then run the command.
#!/bin/bash
chmod 644 /var/log/system.log && tail -f /var/log/system.log

you can always put the permission back with the following command
chmod 640 /var/log/system.log