LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (http://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   Crontab: Cannot see entries, but execution running (http://www.linuxquestions.org/questions/solaris-opensolaris-20/crontab-cannot-see-entries-but-execution-running-4175442145/)

shivaa 12-19-2012 08:38 AM

Crontab: Cannot see entries, but execution running
 
Hello friends!
It's very strange! I had deployed a script in crontab on my system (Sun Solaris 5.8). I was able to check my crontab entries few days ago. But suddenly I found there's nothing in crontab.
If I do:
Code:

crontab -l
crontab: can't open your crontab file.

And if I invoke:
Code:

crontab -e
It opens an empty file.

Well, scripts are still running (as they were scheduled) fine. I am surprized where're my crontab entries? If crontab -l isn't showing them then how they're running...

Can anyone help?

colucix 12-19-2012 08:45 AM

Are you looking at the crontab of the right user? Maybe you did set up the root's crontab and now you're looking at a normal user's crontab. Just a guess.

shivaa 12-19-2012 09:01 AM

Hi colucix,

I do not have root access on this server, but I use only my own account only.

shivaa 12-19-2012 10:40 PM

It's really surprising. There's no entry showing in crontab (crontab -l), but it's still running...
I want to rename a script, so I need to modify the same in cron also.

I do not wish to add new entries, without deleting previous ones, or just want to modify existing ones. Any help please...

colucix 12-20-2012 03:56 AM

Hi shivaa. Any clue from the system logs (maybe you have to ask the system administrator to view them)? Also check in /var/spool/cron/crontabs where the actual users' crontabs are stored.

shivaa 12-20-2012 04:31 AM

Hi colucix,
Unfortunately cron logs do not have read permissions for me. So I can read neither /var/spool/cron/crontabs nor /var/cron/log.
But one thing, this is a generic Unix account (named, saldap) and is shared between us 3 guys. Although, I cannot see any file with name saldap in /var/spool/cron/crontabs, so I doubt one of other 2 guys has removed cron entries (I guess he invoked, crontab -r)... But first need to confirm with them.

Meanwhile, if crontab entries have removed, then how it's still working? Does it save those entreis somewhere in memory or cache...?

colucix 12-20-2012 05:26 AM

Quote:

Originally Posted by shivaa (Post 4853530)
Meanwhile, if crontab entries have removed, then how it's still working? Does it save those entreis somewhere in memory or cache...?

Doubtfully. This means that users cannot truly remove their own crontab. Only the system administrator can save the jobs somewhere else. Another option is that jobs didn't actually terminate and run continuously since their first execution, but you should be aware of that.

:scratch:

wstewart 12-20-2012 07:44 AM

I don't know if it's the same in solaris but in linux there is a directory called /etc/crond.d/ and /etc/cron.daily/|weekly/|monthly/. Scripts in those directories will run just like any other cron job but you won't see them with crontab -l. Maybe an admin moved the script to one of those directories if they didn't just directly add it to the root account or something.


Try running ps -axf around the time the cron job runs to see what user is running it.

shivaa 12-20-2012 07:57 AM

@wstewart: Admin didn't make any changes. And there's no /etc/cron.d in my Solaris system, but only cron.deny.

@colucix: I checked with my collegue and he admitted that he had tried to make some changes. Actually he tried to edit crontab on CLI and his default editor was not set, so it couldn't work properly. He then tried ^C and ^D to exit from that... Rest he do not remember what happened.
Anyway, I am quite sure that something went wrong when he tried to modify crontab.

My scripts periodically update some log files and send a mail everyday, which is still working fine. And it means, somewhere my cron entries are still working. Though I am now thinking to do a crontab -r to clean it and then will add the same entries again. But before this, I want to be assured that no any cron jobs are runing for the user saldap.

colucix 12-20-2012 08:56 AM

It's weird you don't see the saldap entry in /var/spool/cron/crontabs. You can try to modify the EDITOR environment variable to see if something changes, but at this point I think only the sys admin with root privileges can restore a previous working situation.

shivaa 12-20-2012 09:33 AM

Hi colucix,
As you know that file in /var/spool/cron/crontabs, corresponding to the particular user, gets deleted when user or root runs a crontab -r for that user. Since the file i.e. saldap isn't their, so I guess someone has invoked crontab -r... don't know whether intentionally or unintentionally.
Since we very rarely use this server & account, and it's my mistake that I didn't set the EDITOR variable for user saldap, but whenever needed I set it manually (but my collegue was not aware about this).

Anyway, now the question is that, does deleted cron entires goes in any cache or some tmp file...? I really do not understand this behaviour :(

shivaa 02-18-2013 03:38 AM

I found that cron stores or keeps it's entries for some time into cache.
Thanks everyone! Ciao!!


All times are GMT -5. The time now is 08:24 AM.