Professional Web Applications Themes

root crontab run as different user - Linux / Unix Administration

Hello, > I have a backup that needs to be run under a certain user. admin. But the > crontab gets flushed hourly, so I would like to have root run the weekly > backup. > > I know you can run su - admin with in the crontab, but my syntax is not > correct. > This for is for HPUX 11.00 > > 0 0 * * 1 su - admin /home/admin/backup/backup.sh > > /home/admin/backup/backup.log I'm not sure whether I understood your problem crorrectly- but crontabs are user-specific. So you could set up a crontab for admin and ...

  1. #1

    Default Re: root crontab run as different user

    Hello,
    > I have a backup that needs to be run under a certain user. admin. But the
    > crontab gets flushed hourly, so I would like to have root run the weekly
    > backup.
    >
    > I know you can run su - admin with in the crontab, but my syntax is not
    > correct.
    > This for is for HPUX 11.00
    >
    > 0 0 * * 1 su - admin /home/admin/backup/backup.sh >
    > /home/admin/backup/backup.log
    I'm not sure whether I understood your problem crorrectly- but
    crontabs are user-specific.

    So you could set up a crontab for admin and do what you like to do as
    admin and a different crontab for root! This is automatically done if you
    use the "crontab" command.

    Hth
    Martin
    Martin Glora Guest

  2. #2

    Default Re: root crontab run as different user

    "Lhradowy" <laura.hradowyNOSPAM.mts.ca> wrote:
    >I have a backup that needs to be run under a certain user. admin. But the
    >crontab gets flushed hourly, so I would like to have root run the weekly
    >backup.
    >
    >I know you can run su - admin with in the crontab, but my syntax is not
    >correct.
    >This for is for HPUX 11.00
    >
    > 0 0 * * 1 su - admin /home/admin/backup/backup.sh >
    >/home/admin/backup/backup.log
    >
    Should be

    0 0 * * 1 su - admin -c "/home/admin/backup/backup.sh >
    home/admin/backup/backup.log"

    Regards,

    Ted.
    ================================================== ============
    | Ted Linnell <edlinnellacslink.net.au> |
    | |
    | Nunawading, Victoria , Australia |
    ================================================== ============
    Ted Linnell Guest

  3. #3

    Default Re: root crontab run as different user

    Lhradowy wrote:
    > I have a backup that needs to be run under a certain user. admin. But the
    > crontab gets flushed hourly, so I would like to have root run the weekly
    > backup.
    Why is "admins" crontab getting flushed ?
    >
    >
    > I know you can run su - admin with in the crontab, but my syntax is not
    > correct.
    > This for is for HPUX 11.00
    >
    > 0 0 * * 1 su - admin /home/admin/backup/backup.sh >
    > /home/admin/backup/backup.log
    You need to use su -c to put a command on the line



    Ken Green Guest

  4. #4

    Default Re: root crontab run as different user

    Please re-consider if posting to a large number of groups is necessary.

    On Thu, 7 Aug 2003 21:17:54 -0500, Lhradowy
    <laura.hradowyNOSPAM.mts.ca> wrote:
    > I have a backup that needs to be run under a certain user. admin. But the
    > crontab gets flushed hourly, so I would like to have root run the weekly
    > backup.
    >
    > I know you can run su - admin with in the crontab, but my syntax is not
    > correct.
    > This for is for HPUX 11.00
    >
    > 0 0 * * 1 su - admin /home/admin/backup/backup.sh >
    > /home/admin/backup/backup.log
    >
    You could put it in /etc/crontab, where each entry includes a username.


    --
    Excuse me, but didn't I tell you there's NO HOPE for the survival of
    OFFSET PRINTING?
    Bill Marcum Guest

  5. #5

    Default Re: root crontab run as different user

    In article <bh0rq5$sd3op$4ID-134476.news.uni-berlin.de>,
    <davehinzspamcop.net> wrote:
    >In comp.unix.admin Bill Mar <bmariglou.com> wrote:
    >> Please re-consider if posting to a large number of groups is necessary.
    >
    >Please consider not top-posting.
    He didn't. His response to the question was at the bottom, after the
    question. The above comment was a response to the headers, so it was
    placed after them.

    --
    Barry Margolin, [email]barry.margolinlevel3.com[/email]
    Level(3), Woburn, MA
    *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
    Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
    Barry Margolin Guest

  6. #6

    Default Re: root crontab run as different user

    Hello,

    Its very easy.....just login into the box with that user ...admin.

    $EDITOR =vi
    $export EDITOR
    $crontab -e
    set the crontab
    that all
    ....its very simple and easy.

    Regards,
    Atif

    Barry Margolin <barry.margolinlevel3.com> wrote in message news:<dsSYa.57$7R.54news.level3.com>...
    > In article <bh0rq5$sd3op$4ID-134476.news.uni-berlin.de>,
    > <davehinzspamcop.net> wrote:
    > >In comp.unix.admin Bill Mar <bmariglou.com> wrote:
    > >> Please re-consider if posting to a large number of groups is necessary.
    > >
    > >Please consider not top-posting.
    >
    > He didn't. His response to the question was at the bottom, after the
    > question. The above comment was a response to the headers, so it was
    > placed after them.
    Atif Munir Guest

Similar Threads

  1. FMS2 and non-root user
    By Clem in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: March 2nd, 08:40 PM
  2. deleted root user
    By Cteodor in forum MySQL
    Replies: 1
    Last Post: January 29th, 04:37 PM
  3. root equivalent user
    By Ed in forum Linux Setup, Configuration & Administration
    Replies: 17
    Last Post: August 7th, 02:29 PM
  4. Replies: 4
    Last Post: July 17th, 09:24 AM
  5. Secure Normal User <--> Root Communication
    By Michael B Allen in forum UNIX Programming
    Replies: 9
    Last Post: July 7th, 07:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139