Discussion:
root crontab run as different user
(too old to reply)
Ted Linnell
2003-08-08 08:24:42 UTC
Permalink
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 <***@acslink.net.au> |
| |
| Nunawading, Victoria , Australia |
==============================================================
Ken Green
2003-08-08 08:30:46 UTC
Permalink
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
Bill Marcum
2003-08-08 18:16:49 UTC
Permalink
Please re-consider if posting to a large number of groups is necessary.

On Thu, 7 Aug 2003 21:17:54 -0500, Lhradowy
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?
Barry Margolin
2003-08-08 19:01:29 UTC
Permalink
Post by Bill Marcum
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, ***@level3.com
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.
Atif Munir
2003-08-11 11:57:17 UTC
Permalink
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
Post by Barry Margolin
Post by Bill Marcum
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.
Loading...