1 |
on 09/15/2008 05:57 PM Sebastian Redl wrote the following: |
2 |
> Thanasis wrote: |
3 |
>> I attach the /etc/init.d/clock which shows a local "readonly" |
4 |
>> variable that controls a "--noadjfile" option. |
5 |
>> What does the following test do? |
6 |
>> |
7 |
>> if ! touch /etc/adjtime 2>/dev/null ; then |
8 |
>> readonly="yes" |
9 |
>> elif [[ ! -s /etc/adjtime ]] ; then |
10 |
>> echo "0.0 0 0.0" > /etc/adjtime |
11 |
>> fi |
12 |
> First it tests if a touch of /etc/adjtime succeeds. If not, the file |
13 |
> is not writeable, and it sets the readonly variable. |
14 |
> |
15 |
> Then it tests if /etc/adjtime exists (it does, since the touch |
16 |
> succeeded) and has non-zero size. If not, it writes a zero adjust into |
17 |
> the file. |
18 |
> |
19 |
> Sebastian |
20 |
How can I make /etc/adjtime readonly? I tried "chmod a-w /etc/adjtime", |
21 |
but root can always write to it :-) , unless the init script doesn't run |
22 |
as root. |