Author |
Post |
|
#1 Thu Aug 20, 2009 13:16, 188 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
|
Hello all , I have wrote eventhandler script to edit smsd.conf file automatically via sed. It is useful solution to disable / enable modems based on various conditions. Here is code snippset The script replaces some portion of smsd.conf file with aid of just in place editing feature of sed ( sed -i ). This works fine. However after such operation file permissions on smsd.conf file are changed and system admin has no ability to edit it manually. Please advice , what is the proper way to edit file with storing file permissions unchanged.
|
|
#2 Fri Aug 21, 2009 12:56, 188 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
Can you re-check this issue?
I just tried this using sed -i, and it did not change the file permissions. The file was 644 and smsd:dialout, and after sed -i was run by the root, permissions and ownership were the same. Changes to the file were made correctly, but it was just a single line change.
|
|
#3 Fri Aug 21, 2009 13:09, 188 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
what is your sed version number ?
|
|
#4 Fri Aug 21, 2009 13:13, 188 months ago.
|
Administrator
Registered: May 2009
Location: Jyväskylä, Finland
|
GNU sed version 4.1.2
|
|
#5 Fri Aug 21, 2009 13:18, 188 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
may be this is version dependent feature. I will explore it.
Thanks !
|
|
#6 Thu Sep 03, 2009 12:24, 188 months ago.
|
Member
Registered: Jun 2009
Location: Russian Federation
Topic owner
|
Please close this post. sed handles file permissins properly during inline editing.
my mistake.
|