Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #3934

Re: How do you use the "at" command?

From Robert Heller <heller@deepsoft.com>
Organization Deepwoods Software
Subject Re: How do you use the "at" command?
References <jfupll$nq0$1@dont-email.me> <8fCUq.10324$Sh7.9348@newsfe15.iad> <jhCUq.496$0C4.456@newsfe05.iad>
Newsgroups comp.os.linux.misc
Message-ID <P5WdnXHRScYehb7SnZ2dnUVZ_hCdnZ2d@posted.localnet> (permalink)
Date 2012-01-27 15:34 -0600

Show all headers | View raw


At Fri, 27 Jan 2012 13:45:34 -0500 Lew Pitcher <lpitcher@teksavvy.com> wrote:

> 
> On Friday 27 January 2012 13:43, in comp.os.linux.misc,
> lpitcher@teksavvy.com wrote:
> 
> > On Friday 27 January 2012 13:16, in comp.os.linux.misc,
> > Todd@invalid.invalid wrote:
> > 
> >> Hi All,
> >> 
> >>     Maybe I am a bit dense here, but the man page for "at"
> >> is more than a bit confusing to me.
> >> 
> >>     What I want to do is run the follow two commands
> >> as root at a specific time:
> >> 
> >>         su root -c "touch /forcefsck; reboot"
> >> 
> >>     How do I do that with "at"?
> > 
> > Not easily
> > 
> > Your su command will need access to a tty device (real or pseudo) in order
> > to acquire root's password. The at(1) command doesn't provide such a file.
> > This means that your su command will fail or hang, and won't get far
> > enough to process it's commandline.
> > 
> > Assuming that you remove such password protection around root, then you
> > could just
> >   echo 'su root -c "touch /forcefsck; reboot"' | at now + 5 minutes
> > to have the command executed in five minutes (substitute the appropriate
> > at(1) options for your intended schedule).
> 
> A possible workaround of the su password problem:
>   su root -c 'echo "touch /forcefsck; reboot" | at now + 5 minutes'
> and answer the password request immediately
> 
> Note: I have not tried this; you may have to fiddle with the quotes (single
> and double), and password prompt.

I have done:

sudo at now + 5 minutes <somejob.bat

where somejob.bat contains commands to be run as root.

# Shutdown in 5 minutes and force a fsck on boot.
sudo /sbin/shutdown -F +5

# Shutdown at 11pm and force a fsck on boot.
sudo /sbin/shutdown -F 23:00

(sudo does pretty much what su does.)

> 
> HTH

-- 
Robert Heller             -- 978-544-6933 / heller@deepsoft.com
Deepwoods Software        -- http://www.deepsoft.com/
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments


                                                                                 

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 10:16 -0800
  Re: How do you use the "at" command? Lew Pitcher <lpitcher@teksavvy.com> - 2012-01-27 13:43 -0500
    Re: How do you use the "at" command? Lew Pitcher <lpitcher@teksavvy.com> - 2012-01-27 13:45 -0500
      Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-27 15:34 -0600
        Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 22:41 -0800
          Re: How do you use the "at" command? Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2012-01-28 10:27 +0000
            Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-01-28 19:05 +0100
              Re: How do you use the "at" command? Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> - 2012-01-28 10:26 -0800
              Re: How do you use the "at" command? Loki Harfagr <l0k1@thedarkdesign.free.fr.INVALID> - 2012-01-30 08:51 +0000
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-01-31 03:16 +0100
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-02-01 00:24 +0100
                Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-31 17:55 -0600
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-02-01 02:01 +0100
                Re: How do you use the "at" command? "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2012-01-31 21:36 -0500
                Re: How do you use the "at" command? "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2012-01-31 21:25 -0500
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-02-01 04:57 +0100
                Re: How do you use the "at" command? Darren Salt <news@youmustbejoking.demon.cu.invalid> - 2012-01-31 23:46 +0000
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-02-01 02:12 +0100
  Re: How do you use the "at" command? Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-27 19:10 +0000
    Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 11:17 -0800
      Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-27 15:34 -0600
  Re: How do you use the "at" command? unruh <unruh@invalid.ca> - 2012-01-27 20:26 +0000
    Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 22:51 -0800
  Re: How do you use the "at" command? Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> - 2012-01-27 12:23 -0800
    Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-27 15:35 -0600
      Re: How do you use the "at" command? Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> - 2012-01-27 17:22 -0800
        Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-27 20:25 -0600
          Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 22:49 -0800
            Re: How do you use the "at" command? Bit Twister <BitTwister@mouse-potato.com> - 2012-01-28 07:16 +0000
              Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 23:57 -0800
        Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 22:49 -0800
          Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-28 06:07 -0600
            Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-28 13:32 -0800
              Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-28 22:28 -0600
                Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-28 22:50 -0800
                Re: How do you use the "at" command? Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> - 2012-01-28 23:35 -0800
                Re: How do you use the "at" command? unruh <unruh@invalid.ca> - 2012-01-29 18:46 +0000
                Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-29 12:03 -0800
                Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-29 15:38 -0600
                Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-29 16:58 -0800
                Re: How do you use the "at" command? unruh <unruh@invalid.ca> - 2012-01-30 01:36 +0000
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-01-30 03:07 +0100
                Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-29 19:21 -0800
                Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-29 19:17 -0800
                Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-29 11:48 -0800
                Re: How do you use the "at" command? Robert Heller <heller@deepsoft.com> - 2012-01-29 07:35 -0600
                Re: How do you use the "at" command? Aragorn <stryder@telenet.be.invalid> - 2012-01-29 20:40 +0100
          Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-02-03 13:25 -0800
      Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 22:45 -0800
    Re: How do you use the "at" command? Todd <Todd@invalid.invalid> - 2012-01-27 22:42 -0800

csiph-web