On Wednesday 02 June 2004 08.01, Basil Chupin wrote:
Anders Johansson wrote:
On Tuesday 01 June 2004 20.18, C Hamel wrote:
Wow!! I'm really impressed with the number of people who find it difficult to see the work SCRIPT!! <LOL>
and I'm impressed by the number of people who haven't a clue what a script is.
OK, are you sitting down- you are about to be impressed again :-).
I didn't know that.
I always assumed that a script was akin to a batch file (as in Windows).
I don't know. Are there things you can do in a batch file that you can't do from a plain dos prompt? Because there's nothing you can do in a bash script that you can't do from a bash command line. I guess they're somewhat equivalent, although if you just say "script" then the terms are very different. The generic term "script" could just as easily be applied to other programs, not just shells
A script is a sequence of one or more shell commands.
my mistake here. Sorry 'bout that. That should have read "A _shell_ script is..."
ls
is a script
killall
is a script
if you want to put your script in a file, you should put #!<command> on the first line, where <command> is the program you want to execute your sequence of commands. That's it. That's what a script is.
When I read the above you could have blown me over with a feather. Live and learn.
Could this then be the reason why what is suggested in Suse's Support Database about getting the time synced with a time server is not working for me.
The SD states that to sync time one issues the command
ntpdate <URL of time server>
followed by
hwclock -w
and Voila! your system clock will be in perfect sync with the atomic (or neutron or whatever) clock of the server of your choice.
What I have been doing, as root, is to issue this command after I have made a connection to the 'Net:
ntpdate 203.21.37.18 && hwclock -w
and the clock gets synced.
The SD further states that one can automate this by creating a file called ip-up.local in /etc/ppp/ and placing these commands in it and the time will be synced on each connect to the 'Net.
So I did as suggested - but this doesn't appear to be working because my time can get anything up to 90 seconds out after the connection and me executing the commands manually a few seconds after the connect.
From your comments about the '#!<command>', do I need to rewrite the ip-up.local file to begin with
#!ntpdate 203.21.37.18 #!hwclock -w
No no, the <command> there is /bin/bash, since that is what you're using to run your commands. The fact that your commands also happen to be external programs is less important. In a python script, the <command> would be /usr/bin/python, in a perl script the <command> would be /usr/bin/perl and so on. A script file can only have one hash-bang (the term used for #!), and it needs to be the first line in the script, and the program referenced in the hash-bang is the program that is run by the system. Anything else in that file is then the responsibility of that program to interpret and execute So in your case ip-up.local should look like <quote> #!/bin/bash ntpdate 203.21.37.18 && hwclock -w </quote> since /etc/ppp/ip-up executes it instead of "sourcing" it. If the line in /etc/ppp/ip-up had been ". /etc/ppp/ip-up.local" (dot space) then you wouldn't have needed the hash-bang, since then bash would have read the file as part of the current script