Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to script

0 views
Skip to first unread message

dolphin

unread,
Nov 9, 2009, 6:17:39 AM11/9/09
to
Hi,

I want to schdule shutdown with -t option but this option will prompt
me to answer "yes" or "no". How to go about putting in the yes in the
script?

Thanks in advance.

Igor Pozgaj

unread,
Nov 9, 2009, 12:16:38 PM11/9/09
to
On 2009-11-09, dolphin <yc28...@yahoo.com.sg> wrote:
> Hi,
>
> I want to schdule shutdown with -t option but this option will prompt
> me to answer "yes" or "no". How to go about putting in the yes in the
> script?

Something similar:

select CHOICE in yes no
do
case $CHOICE in
yes) shutdown ...;;
no) break;;
*) echo Invalid selection;;
esac
done

HTH,
Igor

--
Igor Pozgaj | ipozgaj at gmail.com (GTalk / MSN)
ICQ: 126002505 | http://fly.srk.fer.hr/~ipozgaj
PGP: 0xEF36A092 | http://ipozgaj.blogspot.com
fb, lfm, li, dA | http://twitter.com/ipozgaj

Ted Linnell

unread,
Nov 10, 2009, 4:32:21 AM11/10/09
to
Igor Pozgaj <ipo...@nospam.fly.srk.fer.hr> wrote:

>On 2009-11-09, dolphin <yc28...@yahoo.com.sg> wrote:
>> Hi,
>>
>> I want to schdule shutdown with -t option but this option will prompt
>> me to answer "yes" or "no". How to go about putting in the yes in the
>> script?
>
>Something similar:
>
>select CHOICE in yes no
>do
> case $CHOICE in
> yes) shutdown ...;;
> no) break;;
> *) echo Invalid selection;;
> esac
>done
>
>HTH,
>Igor

I have not looked at AIX for a couple of years, but I seem to remember
a -y option (answer "yes" to all messages), of course that could be on
a different flavor, definitely on hp-ux.

Regards,

Ted.
==============================================================
| Ted Linnell <edli...@acslink.net.au> |
| |
| Nunawading, Victoria , Australia |
==============================================================

Heinrich Mislik

unread,
Nov 10, 2009, 5:49:07 AM11/10/09
to
In article <74fef70d-d215-429f...@2g2000prl.googlegroups.com>, yc28...@yahoo.com.sg says...

>I want to schdule shutdown with -t option but this option will prompt
>me to answer "yes" or "no". How to go about putting in the yes in the
>script?

/usr/sbin/shutdown is a ksh-script and simply does 'read ans'.

Try

yes | shutdown -t ....

cheers

Heinrich

--
Heinrich Mislik
Zentraler Informatikdienst der Universitaet Wien
A-1010 Wien, Universitaetsstrasse 7
Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140

Gary R. Hook

unread,
Nov 10, 2009, 2:50:18 PM11/10/09
to
dolphin wrote:
> I want to schdule shutdown with -t option but this option will prompt
> me to answer "yes" or "no". How to go about putting in the yes in the
> script?

You might find it easier to use the 'at' command to run your job in the
future. For example, a remote command might be:

ssh remotesystem 'echo shutdown -Fr | at now'

Does a beautiful job of rebooting a remote system via an ssh command.
Not that ssh is required. Using at will also avoid the need to
interact with the command.

Barring that you can run 'yes | shutdown...'

Henry

unread,
Nov 11, 2009, 10:45:08 PM11/11/09
to

from the HMC ?

dolphin

unread,
Nov 13, 2009, 12:55:41 AM11/13/09
to
On Nov 10, 6:49 pm, Heinrich.Mis...@univie.ac.at (Heinrich Mislik)
wrote:
> In article <74fef70d-d215-429f-92c9-fc7e75de3...@2g2000prl.googlegroups.com>, yc282...@yahoo.com.sg says...

>
> >I want to schdule shutdown with -t option but this option will prompt
> >me to answer "yes" or "no". How to go about putting in the yes in the
> >script?
>
> /usr/sbin/shutdown is a ksh-script and simply does 'read ans'.
>
> Try
>
> yes | shutdown -t ....
>
> cheers
>
> Heinrich
>
> --
> Heinrich Mislik
> Zentraler Informatikdienst der Universitaet Wien
> A-1010 Wien, Universitaetsstrasse 7
> Tel.: (+43 1) 4277-14056, Fax: (+43 1) 4277-9140

Hi Heinrich,

Your solution works. Thanks a lot :)

Niel Lambrechts

unread,
Nov 14, 2009, 5:10:21 AM11/14/09
to
On 2009/11/09 1:17 PM, dolphin wrote:
> I want to schdule shutdown with -t option but this option will prompt
> me to answer "yes" or "no". How to go about putting in the yes in the
> script?

shutdown -t now

Regards,
Niel

0 new messages