[Novalug] Installing rpms via an automated script
Dan Lavu
dan at lavu.net
Sun Mar 11 22:04:26 EDT 2012
Jim,
I had my syntax wrong, try
script.sh 2>&1 > your.log
http://jstorimer.com/2011/12/29/the-difference-between-stdout-and-stderr.htm
l
Dan
From: novalug-bounces at calypso.tux.org
[mailto:novalug-bounces at calypso.tux.org] On Behalf Of James Swanson
Sent: Sunday, March 11, 2012 8:50 PM
To: John Holland
Cc: novalug at calypso.tux.org
Subject: Re: [Novalug] Installing rpms via an automated script
I can't autologin as root so that's out. If I run the script as the user,
it runs fine. It runs everything else in the script except the rpm commands
and the yum commands (I tried both). I added a line below #!/bin/bash
$mcaffee.sh>$output.txt 2>&1
but nothing is showing up in the output.txt file.
Jim
On Sun, Mar 11, 2012 at 8:13 PM, John Holland <jbholland at gmail.com> wrote:
I think $script is supposed to be replaced by the name of your script,
$log.file with some file to log output to, and then 2>&1 with the greater
than sign important - there shouldn't be single quotes- whatever is going on
will be in what you put for $log.file
you might also try running it as
$ bash -x $script >$logfile 2>&1
That may produce some explanatory output.
On 3/11/12 8:07 PM, James Swanson wrote:
> Okay, dumb question. I put '$script>$log.file 2&1' with and without the
single quote, but I'm not getting anything. Am I supposed to put that in the
script or somewhere else? Sorry for the questions, I haven't written a shell
script in ages and this got dumped on me.
>
> Jim
>
> On Sun, Mar 11, 2012 at 3:45 PM, Dan Lavu <dan at lavu.net
<mailto:dan at lavu.net> <mailto:dan at lavu.net>> wrote:
>
> James,
>
>
>
> I'm pretty sure I know what the issue is, sudo by default requires a tty
session, you can edit your sudoers file and disable require notty, that
should fix it. If that doesn't work, you can run your script and put the
following at the '$script > $log.file 2&<1' and it will redirect all the
default output to a text file so you can find out what is holding you up.
>
>
>
> Dan
>
>
>
> *From:*novalug-bounces at calypso.tux.org
<mailto:novalug-bounces at calypso.tux.org>
<mailto:novalug-bounces at calypso.tux.org>
[mailto:novalug-bounces at calypso.tux.org
<mailto:novalug-bounces at calypso.tux.org>
<mailto:novalug-bounces at calypso.tux.org>] *On Behalf Of *James Swanson
> *Sent:* Sunday, March 11, 2012 3:35 PM
> *To:* NOVALUG
> *Subject:* [Novalug] Installing rpms via an automated script
>
>
>
> This has me tearing my hair out. I've built an automated script. I have
the user set up to sudo with no password. The script works fine until I get
to the rpm installs. I've put "sudo rpm -ivh /path/to/X.rpm" and I've put
"sudo yum -y install /path/to/X.rpm" with not success. When I'm logged in as
the user, I can run the script just fine, but automated? Nope. Yes, I've set
up environment variables. Am I missing something?
>
>
>
> Jim
>
>
>
>
> _______________________________________________
> Novalug mailing list
> Novalug at calypso.tux.org
> http://calypso.tux.org/mailman/listinfo/novalug
_______________________________________________
Novalug mailing list
Novalug at calypso.tux.org
http://calypso.tux.org/mailman/listinfo/novalug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/novalug/attachments/20120311/47359c08/attachment.html
More information about the Novalug
mailing list