1752742 Members
5176 Online
108789 Solutions
New Discussion юеВ

at -l

 
SOLVED
Go to solution
Miguel Covas
Advisor

at -l

I need to monitor which jobs are submitted by a
group of users (And at what time are scheduled to run). However, at -l will list just the jobs I own. If you run at as root there is no problem, but since I plan to run the monitor from Apache I have a problem. Setting a script with setuid to
root (A solution I don't like) does not solves the problem: at seems to look at the uid or login name, not the effective uid.


The at man states that:
"All users can list and remove their own jobs. Users with appropriate
privileges can list and remove jobs other than their own."

Appropiate privileges? Which privileges?

I could otherwise use a perl script and
examine /var/spool/cron/atjobs/*, which I'm
going to do anyway for I want to know what command is associated to the job. From the owner of the files I can ascertain the user and from the name of the file find out the queue.

The commands go at the end of the file, but
what about the release time that is listed
using "at -l".

I'm wondering if I could fiddle a bit
with the .proto file and (using $t) produce
some line containing seconds since January 1, 1970 .... ooff

There must be a way to allow some user to
look at the jobs from some user group, or
even to all the jobs...

Ideas? Shall I go on with $t mingling?
6 REPLIES 6
Sanjay_6
Honored Contributor

Re: at -l

Hi,

Appropriate privileges is unix way of telling you that you need to be a user with more priviledges than a normal user which in most cases would be root.

You can use sudo to allow a normal user id to run the at command as root.

If you need to download sudo, try this link,

http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.8p9/

If you need more information on sudo, just search this forum with the keyword sudo.

Hope this helps.

regds
James R. Ferguson
Acclaimed Contributor
Solution

Re: at -l

Hi Miquel:

I'm not sure what you are missing. The jobs in '/var/adm/cron/atjobs' are world-readable and have a name like:

/var/adm/cron/atjobs/1135284360.a

...where the digits of the basename are the epoch seconds.

Perl is an ideal choice for parsing the directory and its file's contents *and* (of course) turning a file's basename into the task's starttime. There should be no need to munge with the '.proto' $t.

Regards!

...JRF...
Arturo Galbiati
Esteemed Contributor

Re: at -l

I developped a crsipt called atl which shows you the command submitted.
Feel free to use it.
HTH,
Art
Arturo Galbiati
Esteemed Contributor

Re: at -l

I developped a script called atl which shows you the command submitted.
Feel free to use it.
HTH,
Art
Miguel Covas
Advisor

Re: at -l

What I was missing is the fact that the scheduling time is embedded into the file name of the at job. Perhaps I should have guessed, but the only hint is (again) what the man page says about duplicate time schedules result in the job scheduled in the next available second...

Concerning sudo, I haven't it installed on the HP-UX servers, but on my workstation (Mac OS X) , therefore I can't test it. I am still not convinced that sudo does change the behaviour of "at". A shell script with setuid to root shows an id
uid=222(mcovas) gid=100(sag) euid=0(root)
(i.e. I am privileged)
and
I still get
"you don't own 1135377000.p"

#!/usr/bin/sh
# atjobs.sh
#
ATJOBSDIR=/var/spool/cron/atjobs

id

at -l $(ls $ATJOBSDIR)

exit 0
Miguel Covas
Advisor

Re: at -l

I'll proceed with the perl script