why wont this command work in a script?

why wont this command work in a script?

Post by Thorin Brow » Sun, 14 Oct 2001 19:53:28



ive written the following script.

------------------------------
#!/bin/sh

uptime > /var/www/upt.fthml

<< EOF >>
-----------------------------

when i run it, it doesnt gibe me any errors, but it simply does not DO
'uptime > /var/www/upt.fthml'

why is this?

 
 
 

why wont this command work in a script?

Post by Matthew van de Werke » Sun, 14 Oct 2001 20:08:39



> ive written the following script.

> ------------------------------
> #!/bin/sh

> uptime > /var/www/upt.fthml

> << EOF >>
> -----------------------------

> when i run it, it doesnt gibe me any errors, but it simply does not DO
> 'uptime > /var/www/upt.fthml'

> why is this?

All I can think is that the script is not executable. Did you 'chmod +x' it?

Cheers,
MvdW

 
 
 

why wont this command work in a script?

Post by r0gu » Mon, 15 Oct 2001 01:34:28



> ive written the following script.

> ------------------------------
> #!/bin/sh

> uptime > /var/www/upt.fthml

> << EOF >>
> -----------------------------

> when i run it, it doesnt gibe me any errors, but it simply does not DO
> 'uptime > /var/www/upt.fthml'

> why is this?

You may also need to be running as root to write to the /var/www
directory. I'll assume you intend to put is as a cron job, which would
have root permissions, but testing as user may not work.

--
I will serve no algorithm before it's time.

 
 
 

why wont this command work in a script?

Post by Thorin Brow » Mon, 15 Oct 2001 07:42:36


i have chmod +x ed it and  I am logged in as root

the file's there, and it runs, but it doesnt actually do that command. I can
put 'echo' commands in there and it will echo stuff, but it wont output the
uptime to that file!



> > ive written the following script.

> > ------------------------------
> > #!/bin/sh

> > uptime > /var/www/upt.fthml

> > << EOF >>
> > -----------------------------

> > when i run it, it doesnt gibe me any errors, but it simply does not DO
> > 'uptime > /var/www/upt.fthml'

> > why is this?

> You may also need to be running as root to write to the /var/www
> directory. I'll assume you intend to put is as a cron job, which would
> have root permissions, but testing as user may not work.

> --
> I will serve no algorithm before it's time.

 
 
 

why wont this command work in a script?

Post by Chris F.A. Johnso » Mon, 15 Oct 2001 10:54:07



> i have chmod +x ed it and  I am logged in as root

> the file's there, and it runs, but it doesnt actually do that command. I can
> put 'echo' commands in there and it will echo stuff, but it wont output the
> uptime to that file!



> > > ive written the following script.

> > > ------------------------------
> > > #!/bin/sh

> > > uptime > /var/www/upt.fthml

Have you tried sending it to another file?
E.g.:

uptime > $HOME/uptime

Does that work?

If so, what are the permissions on /var/www?

You have to break it down to the different elements:

Do you get output from uptime?
Can you redirect it to another file?
Can you direct the output of some other command (e.g. echo) to
/var/www/upt.fthml?

--

        =================================================================


 
 
 

why wont this command work in a script?

Post by r0gu » Wed, 17 Oct 2001 03:34:41



> i have chmod +x ed it and  I am logged in as root

> the file's there, and it runs, but it doesnt actually do that command. I can
> put 'echo' commands in there and it will echo stuff, but it wont output the
> uptime to that file!



>>>ive written the following script.

>>>------------------------------
>>>#!/bin/sh

>>>uptime > /var/www/upt.fthml

>>><< EOF >>
>>>-----------------------------

>>>when i run it, it doesnt gibe me any errors, but it simply does not DO
>>>'uptime > /var/www/upt.fthml'

>>>why is this?

>>You may also need to be running as root to write to the /var/www
>>directory. I'll assume you intend to put is as a cron job, which would
>>have root permissions, but testing as user may not work.

>>--
>>I will serve no algorithm before it's time.

I created the script as you typed it, and it seems to work fine on my
system, so I am not sure why it will not work for you.  The only thing I
can think of is permissions on the target directory, or file.

--
I will serve no algorithm before it's time.

 
 
 

1. why does i=`echo -n $b` work on command line, but not in script?

I'm trying to whack a newline character in a script.

Here's the snippet of code:

   rawline=`grep "$RUNNABLE" $OUTPUT | cut -f6 -d '<' | tr -d '>'`
   line=`echo -n $rawline`
   echo "This is line variable: $line ."

When I do this on the command line, it properly whacks the newline and
returns my grep result.  When I place this in a script, my output of
grep is prepended with "-n".  This prevents my script from working
correctly.  Why is it doing this, and is there a way to fix it?

TIA

-v

2. PPP and DIP

3. ksh script question: why don't same commands work interactively?

4. tetex doesn't compile LaTeX209 document ??

5. Why wont my lilo install work?

6. Illegal instruction

7. Why wont telnet work with ppp ?

8. CD Audio, question

9. why wont sym links work w/ftp?

10. Why will this simple program wont work?

11. Why wont this syslog.conf work?

12. why wont my soundcard work?

13. "Make" command under SuSE 6.2 wont work!!!...help!