Re: Running something from cron as another user.
From: Andy Marden (amarden@usa.net)Date: 02/17/02
- Next message: William Webb: "Server Compromised through SSH or...?"
- Previous message: Andy Marden: "Re: Running something from cron as another user."
- In reply to: Andy Marden: "Re: Running something from cron as another user."
- Next in thread: Juha Laiho: "Re: Running something from cron as another user."
- Reply: Juha Laiho: "Re: Running something from cron as another user."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Andy Marden" <amarden@usa.net> Date: Sun, 17 Feb 2002 12:44:15 GMT
"Andy Marden" <amarden@usa.net> wrote in message
news:1013949767.729351@ananke.eclipse.net.uk...
> The problem here is that there is already a user running the batch load.
As
> part of the load, if files are detected, I want to be able to bring down
> Postgres in the manner stated, but then I HAVE to be the postgres user it
> seems, not just the group. Don't want to run this all as root, nor as the
> postgres user, but want to be able to shutdown postgres. Happy to
> incorporate a password if necessary.
>
> A crontab as postgres is no good since it has a dependency on the part of
> the load process. Whole process goes something like:
>
> 1. check for files
> 2. restart postgres without -i (*)
> 3. do processing
> 4 restart processing with -i (*)
>
> Ones marked (*) seem to HAVE to be done as postgres user. The other
> shouldn't be.
>
> An 'su -c' might be OK, but it won't accept stdin redirected in.
>
> Andy
>
> "Michael Heiming" <michael+USENET@heiming.de> wrote in message
> news:ig6o4a.v4h.ln@charon.heiming.de...
> > luke@bell-bird.com.au wrote:
> >
> > > Michael Pye wrote:
> > >>
> > >> Andy Marden wrote:
> > >>
> > >> > I'm running a batch load on PostgreSQL 7.1.3 on Redhat Linux as a
> > >> > given OS user. As
> > >> > part of this, I want to restart the postmaster process with -i
> > >> > access removed and at the
> > >> > end, restart with -i added on (denying network access during the
> > >> > load process). Trouble is, it seems that I have to be the
> > >> > postgres user to do this - I'd hoped that being part of the
> > >> > postgres group would be enough. Has anyone thoughts on how to
> > >> > achieve this (short of running everything as the postgres user).
> > >>
> > >> $ man crontab
> > >>
> > >> CRONTAB(1) CRONTAB(1)
> > >>
> > >> NAME
> > >> crontab - maintain crontab files for individual users (V3)
> > >>
> > >> SYNOPSIS
> > >> crontab [ -u user ] file
> > >> crontab [ -u user ] { -l | -r | -e }
> > >>
> > >> DESCRIPTION
> > >> Crontab is the program used to install, deinstall or list
> > >> the tables used to drive the cron(8) daemon in Vixie Cron.
> > >> Each user can have their own crontab, and though these are
> > >> files in /var, they are not intended to be edited
> > >> directly.
> > >>
> > >> So write your cron entry, stick it in postgreload.cron and try
> > >>
> > >> $ crontab -u postgre postgreload.cron
> > >>
> > >> Problem?
> > >>
> > >> MP
> > >
> > > Unless he is root, that wont work will it?
> > No, it won't
> > # crontab -u <user>
> > crontab: usage error: file name must be specified for replace
> >
> > > If he is root, he could su.
> > Not needed
> >
> > Use (as root):
> > # crontab -u <user> -e
> >
> > Or put everything in /etc/crontab if your system uses this, where you
> > can run what you like as which ever user you like.
> >
> > 'man crontab' for more info.
> >
> > Michael Heiming
> > --
> > Remove the +SIGNS case mail bounces.
>
>
- Next message: William Webb: "Server Compromised through SSH or...?"
- Previous message: Andy Marden: "Re: Running something from cron as another user."
- In reply to: Andy Marden: "Re: Running something from cron as another user."
- Next in thread: Juha Laiho: "Re: Running something from cron as another user."
- Reply: Juha Laiho: "Re: Running something from cron as another user."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|