Policy to insert line in a config

mhgmuser
New Contributor

Hello everyone
Sorry - I'm new to jamf.

I need to create a policy that inserts a line in a config file.

Do you have any ideas on how I should proceed here?

Best regards

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Can you give us a little more detail here? By "config file" you don't mean a Configuration Profile, right? You're talking about a local file, like a config.ini or something along those lines sitting on the Mac?

If the insert is just a new line, and not replacing anything, it's not hard to do in a script. You can typically just echo a new line into the file, like /bin/echo "some new line" >> /path/to/config

If it has to change an existing line, then you would use sed for that, not echo.

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

Can you give us a little more detail here? By "config file" you don't mean a Configuration Profile, right? You're talking about a local file, like a config.ini or something along those lines sitting on the Mac?

If the insert is just a new line, and not replacing anything, it's not hard to do in a script. You can typically just echo a new line into the file, like /bin/echo "some new line" >> /path/to/config

If it has to change an existing line, then you would use sed for that, not echo.

mhgmuser
New Contributor

Hi @mm2270 
Sorry, I will give little more details next time.
You've helped me a lot!

Thanks again.