Re: Can I change group and permissions on the messages file?



On 2006-09-25, Ohmster wrote:
Bit Twister <BitTwister@xxxxxxxxxxxxxxxx> wrote in
news:slrnehe7cr.u2.BitTwister@xxxxxxxxxxxxxxx:

Do not run FCx myself but you could create a script in
/etc/cron.daily to check/change it to whatever you like.

#********* start of my_kludge **************

_var_fn=/var/log/messages
_priv=$(/bin/stat -c %a $_var_fn)

if [ $_priv -ne 640 ] ; then
/bin/chmod 640 $_var_fn
fi

#************** end my_kludge *********************

I just put your script in an executable text file and tried it out, no
good, it will not work.

[root@ohmster scripts]# /root/scripts/change_messages_perms
/root/scripts/change_messages_perms: line 4: /bin/stat: No such file or
directory

Do NOT use the full path to a system executable (use stat rather
than /bin/stat; the same for chmod). Such files will be in your
PATH (unless you've screwed it up), but not all systems have them
in the same place; stat is not a standard command, so FC3 could
place it somewhere else.

/root/scripts/change_messages_perms: line 6: [: -ne: unary operator
expected
[root@ohmster scripts]#

Well it looked pretty cool anyway.


--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.



Relevant Pages