Operating System - HP-UX
1821088 Members
3183 Online
109631 Solutions
New Discussion юеВ

Blond moment -- crontab question (easy 10 pts)

 
SOLVED
Go to solution
John Collier
Esteemed Contributor

Blond moment -- crontab question (easy 10 pts)

I know it is possible to use the crontab command from root on HPUX 11x and get the info for any user with the syntax:

crontab -l [username]
crontab -e [username]
crontab -r [username]

Believe it or not, we still have some old HPUX 10x boxes here. My problem is that we can't seem to get the same syntax listed above to work on the 10x systems.

I don't remember it being different on them. Which one of us is wrong, me or the system?

How do I get what I am looking for on the old 10x systems?
"I expect to pass through this world but once. Any good, therefore, that I can do, or any kindness that I can show to any human being, let me do it now. Let me not defer or neglect it, for I shall not pass this way again." Stephen Krebbet, 1793-1855
9 REPLIES 9
Steven E. Protter
Exalted Contributor

Re: Blond moment -- crontab question (easy 10 pts)

John,

I don't have any 10.x boxes here. I checked my email archive and my predecessor's and saw no notes indicating a change in cron behavior. I have some scripts that existed in our 10.20 days and they use those specific commands to provide documentation and reports.

Either they didn't work, or my predecessors documentation had bad dates in it.

I think it should work.

Maybe files are missing in /var/adm/cron

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
MarkSyder
Honored Contributor
Solution

Re: Blond moment -- crontab question (easy 10 pts)

Hi John,

Same here on a 10.20 server. I've checked the man page and that doesn't say anything about running it for another user.

Have you tried:

su - username -c crontab -l?

Mark Syder (like the drink but spelt different)
The triumph of evil requires only that good men do nothing
Pete Randall
Outstanding Contributor

Re: Blond moment -- crontab question (easy 10 pts)

JC,

Have you checked the allow and deny files to make sure these users are even able to access cron?


Pete

Pete
Jeff Schussele
Honored Contributor

Re: Blond moment -- crontab question (easy 10 pts)

Hi JC,

From the 10.2 crontab man page on docs.hp.com

/Quote

NAME
crontab - user job file scheduler

SYNOPSIS

crontab [file]

crontab -e

crontab -l

crontab -r

DESCRIPTION

The crontab command manages a crontab file for the user. You can use a crontab file to schedule jobs that are executed automatically by cron (see cron(1M) ) on a regular basis. The command has four forms:
crontab [file]
Create or replace your crontab file by copying the specified file, or standard input if file is omitted or - is specified as file , into the crontab directory, /var/spool/cron/crontabs. The name of your crontab file in the crontab directory is the same as your effective user name.
crontab -e Edit a copy of your crontab file, or create an empty file to edit if the crontab file does not exist. When editing is complete, the file will be copied into the crontab directory as your crontab file.
crontab -l List your crontab file.
crontab -r Remove your crontab file from the crontab directory.

/EndQuote

Note that *user* is not listed in the syntax.
So apparently it was not available in 10.2

And here's the page from the 11.0 page

/Quote

NAME
crontab - user job file scheduler

SYNOPSIS

crontab [file]

crontab -e [username]

crontab -l [username]

crontab -r [username]

DESCRIPTION

The crontab command manages a crontab file for the user. You can use a crontab file to schedule jobs that are executed automatically by cron (see cron(1M) ) on a regular basis. The command has four forms:
crontab [file]
Create or replace your crontab file by copying the specified file, or standard input if file is omitted or - is specified as file , into the crontab directory, /var/spool/cron/crontabs. The name of your crontab file in the crontab directory is the same as your effective user name.
crontab -e [username]
Edit a copy of the user's crontab file, or create an empty file to edit if the crontab file does not exist. When editing is complete, the file will be copied into the crontab directory as the user's crontab file.
crontab -l [username]
Lists the user's crontab file.
crontab -r [username]
Remove the user's crontab file from the crontab directory.

Only a privileged user can use username following the -e, -l, or -r options, to edit, list, or remove the crontab file of the specified user

/EndQuote

So it appears to me that the functionality first appeared in 11.0.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jose Mosquera
Honored Contributor

Re: Blond moment -- crontab question (easy 10 pts)

Hi,

Syntax is the same on 10.20.

It is obvious to consult the information in /var/spool/cron/crontabs/

Rgds.
Ken Penland_1
Trusted Contributor

Re: Blond moment -- crontab question (easy 10 pts)

yeah, I tried crontab -l USERNAME and it didnt work...only way I found to get it to work:

su USERNAME -c "crontab -l"
'
Jdamian
Respected Contributor

Re: Blond moment -- crontab question (easy 10 pts)

man pages shown by Jeff are clear...

crontab in HP-UX 10.20 doesn't accept an user name after options.
Steven E. Protter
Exalted Contributor

Re: Blond moment -- crontab question (easy 10 pts)

So only an admin can see others cron schedules. That makes sense. Thanks for posting the man page Jeff.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
John Collier
Esteemed Contributor

Re: Blond moment -- crontab question (easy 10 pts)

Sorry for not making it clear that we were looking to do this from the root account, not a normal user account to another.

SEP,

Looks like you and I suffer from the same 'should work' syndrome. I guess that we have both gotten so used to seeing it recently that it just did not click. At least I am in good company on that one.

Pete,
I see that I misled you as well. For that, I apologize. It was not an issue of users not being able to access their own crontab, it was more of looking for things that are running on a box that is currently ailing.


Jeff,

Thanks for the details. I read that online, but it did not click in my head that the [username] option was not listed. I saw the [file] and the mind went numb from there. Like I said, blond moment. As you can probably tell, I was not sitting at the keyboard, just attempting to brainstorm with the one that was.
(Nice salad. Did I miss that? I really should visit more often, huh?)


Thanks to all that chimed in. It looks like the entire situation is so far degraded that the man in charge is going to try to load from a bootable tape (if he can remember the syntax to point it to the correct path to make it work).

Have a great day!
"I expect to pass through this world but once. Any good, therefore, that I can do, or any kindness that I can show to any human being, let me do it now. Let me not defer or neglect it, for I shall not pass this way again." Stephen Krebbet, 1793-1855