1 |
Thanasis wrote: |
2 |
> I attach the /etc/init.d/clock which shows a local "readonly" variable |
3 |
> that controls a "--noadjfile" option. |
4 |
> What does the following test do? |
5 |
> |
6 |
> if ! touch /etc/adjtime 2>/dev/null ; then |
7 |
> readonly="yes" |
8 |
> elif [[ ! -s /etc/adjtime ]] ; then |
9 |
> echo "0.0 0 0.0" > /etc/adjtime |
10 |
> fi |
11 |
First it tests if a touch of /etc/adjtime succeeds. If not, the file is |
12 |
not writeable, and it sets the readonly variable. |
13 |
|
14 |
Then it tests if /etc/adjtime exists (it does, since the touch |
15 |
succeeded) and has non-zero size. If not, it writes a zero adjust into |
16 |
the file. |
17 |
|
18 |
Sebastian |