Mailinglist Archive: opensuse (5100 mails)

< Previous Next >
Re: [SLE] How to find PID
  • From: Basil Chupin <blchupin@xxxxxxxxxx>
  • Date: Wed, 02 Jun 2004 21:42:39 +1000
  • Message-id: <40BDBD2F.8050802@xxxxxxxxxx>
Anders Johansson wrote:
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..."


is a script


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 && 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

#!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


ntpdate && hwclock -w

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

Thank you for the explanation.

I've looked inside a similar file in /etc/ppp/ and found that it begins with #!/bin/sh and not .../bash so I used sh in my new ip-up.local file. I'll see what happens at the next logon.

And while I don't fully understand the whole thing, I can see a glimmer of a light in what you said in the last paragraph about /etc/ppp/ip-up and how it picks-up ip-up.local.


I am not young enough to know everything.

< Previous Next >
Follow Ups