niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » AIX
shell scripts and cron
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
TB
*nix forums Guru Wannabe


Joined: 14 Mar 2005
Posts: 241

PostPosted: Mon Feb 07, 2005 12:04 pm    Post subject: Re: shell scripts and cron Reply with quote

I was assuming that nothing was happening because there was nothing in
the process table (ps -ef) after I ran it.
Back to top
Laurenz Albe
*nix forums Guru


Joined: 21 Feb 2005
Posts: 478

PostPosted: Mon Feb 07, 2005 10:21 am    Post subject: Re: shell scripts and cron Reply with quote

Laurenz Albe <albe@culturallnospam.com> wrote:
<snip answer>

I replied before I found out that the guy multiposted in at least three
newsgroups :^P

Laurenz Albe
Back to top
Laurenz Albe
*nix forums Guru


Joined: 21 Feb 2005
Posts: 478

PostPosted: Mon Feb 07, 2005 10:00 am    Post subject: Re: shell scripts and cron Reply with quote

TB <chessgame@gmail.com> wrote:
Quote:
What happens if you don't put the traditional #!/bin/sh (or #!/bin/ksh)
in the first line of a script??

I guess the current shell is used. Try it out!
Maybe the behaviour depends on the current shell...
What is your current shell?
What shells are installed on your system?
What is your default shell?

Quote:
Here is my problem. I have some very simple scripts that don't have
this in the first line. A user's crontab is what normaly runs these
scripts and they run fine. I needed to run one manually so I ran it as
the full path. i.e. '/path/to/script/scriptname'. When I did, the
cursor dropped to the next line and nothing else happened.

Why do you assume that nothing happened? Just because you didn't see
a thing? Or because you could not see it in the process list a long
(by machine standards) time after you typed the command?

Quote:
I did a ps
(from another session) and looked for the script in the process table.
It was not there. But when I entered '/bin/sh
/path/to/script/scriptname' the same thing happened with the prompt,
but there was a process running in the ps table.

One way to see what is actually happening is to insert a 'set -x' near
the beginning of the shell script. That way you get a trace of all
commands executed on standard error. Look out for differences!

Quote:
These scripts have previously been ran manually but from the directory
where they reside and it worked. How can they run from the directory,
but not from the users home directory???

For example, if they reference a relative file name.

All your questions seem to lead in different directions, as if you
haven't made up your mind yet what your problem is.

Is there something special you want to achieve?
Or (which is fine) are you just probing around and try to get a better
understanding of how shell scripts work?

Yours,
Laurenz Albe
Back to top
TB
*nix forums Guru Wannabe


Joined: 14 Mar 2005
Posts: 241

PostPosted: Mon Feb 07, 2005 3:32 am    Post subject: Re: shell scripts and cron Reply with quote

Forgot, this is AIX5.2 if that matters.
Back to top
TB
*nix forums Guru Wannabe


Joined: 14 Mar 2005
Posts: 241

PostPosted: Mon Feb 07, 2005 3:25 am    Post subject: shell scripts and cron Reply with quote

I need a shell question answered if someone could.

What happens if you don't put the traditional #!/bin/sh (or #!/bin/ksh)
in the first line of a script??

Here is my problem. I have some very simple scripts that don't have
this in the first line. A user's crontab is what normaly runs these
scripts and they run fine. I needed to run one manually so I ran it as
the full path. i.e. '/path/to/script/scriptname'. When I did, the
cursor dropped to the next line and nothing else happened. I did a ps
(from another session) and looked for the script in the process table.
It was not there. But when I entered '/bin/sh
/path/to/script/scriptname' the same thing happened with the prompt,
but there was a process running in the ps table.

These scripts have previously been ran manually but from the directory
where they reside and it worked. How can they run from the directory,
but not from the users home directory???
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 9:58 pm | All times are GMT
navigation Forum index » *nix » AIX
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts rc.d shell script Kaitlyn Luna FreeBSD 7 Wed Jul 19, 2006 5:29 am
No new posts how to use Env variables & its path in ksh shell script dalu.gelu@gmail.com shell 8 Tue Jul 18, 2006 1:12 pm
No new posts sleep interrupts in Bourne vs. Korn shell Andy Haupt shell 2 Mon Jul 17, 2006 10:23 pm
No new posts execute a shell script from a python script spec python 7 Mon Jul 17, 2006 8:11 pm
No new posts Top 10 subjects comp.unix.shell Heiner Steven shell 0 Sun Jul 16, 2006 11:02 pm

Debt Consolidation | Bankruptcy | Mobile Phones | Free Animated Greetings | Myspace Layouts
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1472s ][ Queries: 20 (0.0644s) ][ GZIP on - Debug on ]